PHPackages                             arraypress/wp-sanitize-polyfills - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. arraypress/wp-sanitize-polyfills

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arraypress/wp-sanitize-polyfills
================================

Additional sanitization functions that complement WordPress core.

04PHP

Since Jan 31Pushed 3mo agoCompare

[ Source](https://github.com/arraypress/wp-sanitize-polyfills)[ Packagist](https://packagist.org/packages/arraypress/wp-sanitize-polyfills)[ RSS](/packages/arraypress-wp-sanitize-polyfills/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress Sanitize Polyfills
============================

[](#wordpress-sanitize-polyfills)

Additional sanitization functions that complement WordPress core. These functions follow WordPress naming conventions and feel like native functions that should exist in core.

Installation
------------

[](#installation)

```
composer require arraypress/wp-sanitize-polyfills
```

Functions
---------

[](#functions)

### sanitize\_object\_ids

[](#sanitize_object_ids)

Sanitize an array of object IDs (post IDs, term IDs, user IDs, etc.).

```
$ids = sanitize_object_ids( [ '1', 2, '3', 0, '', 2, 'abc' ] );
// Returns: [ 1, 2, 3 ]
```

### sanitize\_amount

[](#sanitize_amount)

Sanitize a monetary/decimal amount.

```
$price = sanitize_amount( '$1,234.567' );
// Returns: '1234.57'

$price = sanitize_amount( '99.9', 0 );
// Returns: '100'

$price = sanitize_amount( '-45.5', 2 );
// Returns: '-45.50'
```

### sanitize\_comma\_list

[](#sanitize_comma_list)

Sanitize a comma-separated list into an array.

```
$tags = sanitize_comma_list( 'apple, banana, , cherry' );
// Returns: [ 'apple', 'banana', 'cherry' ]
```

### sanitize\_newline\_list

[](#sanitize_newline_list)

Sanitize a newline-separated list into an array.

```
$lines = sanitize_newline_list( "line one\nline two\n\nline three" );
// Returns: [ 'line one', 'line two', 'line three' ]
```

### sanitize\_emails

[](#sanitize_emails)

Sanitize a list of email addresses. Accepts comma-separated string, newline-separated string, or array.

```
// From comma-separated string
$emails = sanitize_emails( 'john@example.com, invalid, jane@example.com' );
// Returns: [ 'john@example.com', 'jane@example.com' ]

// From array
$emails = sanitize_emails( [ 'john@example.com', 'not-an-email', 'jane@example.com' ] );
// Returns: [ 'john@example.com', 'jane@example.com' ]
```

### is\_valid\_json

[](#is_valid_json)

Check if a string is valid JSON.

```
is_valid_json( '{"name": "John"}' );  // true
is_valid_json( 'not json' );           // false
is_valid_json( '' );                   // false
```

Requirements
------------

[](#requirements)

- PHP 7.4+
- WordPress (for `sanitize_text_field()`, `sanitize_email()`, `is_email()`)

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance54

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd6eb8aff0903d87eb674d1ba3c5f3653899c0d7661504eb0deb7798ed86b643?d=identicon)[arraypress](/maintainers/arraypress)

---

Top Contributors

[![arraypress](https://avatars.githubusercontent.com/u/22668877?v=4)](https://github.com/arraypress "arraypress (1 commits)")

### Embed Badge

![Health badge](/badges/arraypress-wp-sanitize-polyfills/health.svg)

```
[![Health](https://phpackages.com/badges/arraypress-wp-sanitize-polyfills/health.svg)](https://phpackages.com/packages/arraypress-wp-sanitize-polyfills)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
