rarst/wps

WordPress plugin for whoops error handler.

Installs: 123 631

Dependents: 3

Suggesters: 0

Security: 0

Stars: 125

Watchers: 10

Forks: 15

Open Issues: 0

Type:wordpress-plugin

1.2 2018-12-18 15:43 UTC

This package is auto-updated.

Last update: 2024-10-25 19:30:13 UTC


README

Scrutinizer Code Quality Latest Stable Version Total Downloads PHP version Download wps

wps adds 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

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 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.

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