https://github.com/rarst/wps
WordPress plugin for whoops error handler.
https://github.com/rarst/wps
error-handler whoops wordpress-plugin
Last synced: 17 days ago
JSON representation
WordPress plugin for whoops error handler.
- Host: GitHub
- URL: https://github.com/rarst/wps
- Owner: Rarst
- License: mit
- Created: 2014-10-07T16:37:17.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-03-25T09:56:21.000Z (about 5 years ago)
- Last Synced: 2025-03-31T09:08:49.768Z (24 days ago)
- Topics: error-handler, whoops, wordpress-plugin
- Language: PHP
- Homepage:
- Size: 27.3 KB
- Stars: 127
- Watchers: 9
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# wps — WordPress plugin for whoops
[](https://scrutinizer-ci.com/g/Rarst/wps/?branch=master)
[](https://packagist.org/packages/rarst/wps)
[](https://packagist.org/packages/rarst/wps)
[](https://packagist.org/packages/rarst/wps)
[](https://github.com/Rarst/wps/releases/latest/download/wps.zip)wps adds [whoops](http://filp.github.io/whoops/) error handler to a WordPress installation.
It makes error messages from PHP, `admin-ajax.php`, and WP REST API a _great_ deal more clear and convenient to work with.
## Installation
| [Composer](https://getcomposer.org/) (recommended) | Release archive |
| -------------------------------------------------- | -------- |
| `composer require rarst/wps` | [](https://github.com/Rarst/wps/releases/latest/download/wps.zip) |## Usage
The plugin is meant strictly for development and will only work with `WP_DEBUG` and `WP_DEBUG_DISPLAY` configuration constants enabled.
## Silence errors
whoops can definitely get noisy with a lot of low–grade errors.
Silence errors for irrelevant locations to keep it practical and productive.
### Silence for URL
Use `?wps_disable` query argument in the URL to temporarily disable whoops.
### Silence for path
Use regular expressions to match source file paths and [error constants](https://www.php.net/manual/en/errorfunc.constants.php) to configure what should be silenced.
This can be called multiple times and/or array of paths can be provided.
Note that the direction of slashes needs to match operating system or write your regexes to match either.
```php
global $wps;// Silence notices and warnings for any path.
$wps['run']->silenceErrorsInPaths( '~.*~', E_NOTICE | E_WARNING );// Silence for specific directory.
$wps['run']->silenceErrorsInPaths( '~/wp-admin/~', E_NOTICE | E_WARNING );// Silence _except_ specific directory.
$wps['run']->silenceErrorsInPaths( '~^((?!/my-plugin/).)*$~', E_NOTICE | E_WARNING );// Silence for plugins _except_ specific plugin.
$wps['run']->silenceErrorsInPaths( '~/wp-content/plugins/(?!my-plugin)~', E_NOTICE | E_WARNING );
```## License
MIT