How to eliminate error warnings about ini_set?

5.3k Views Asked by At

my wordpress error log is filling up with this message:

PHP Warning:  ini_set() has been disabled for security reasons in  
             /home/mywebsite/public_html/wp-includes/load.php on line 271

that line reads: ini_set( 'display_errors', 0 );

any suggestions on how to eliminate error warnings?

1

There are 1 best solutions below

1
On

You are seeing that error because the XMLRPC_REQUEST constant is set to true, which causes WordPress to try and disable error reporting with the following:

if ( defined( 'XMLRPC_REQUEST' ) )
    ini_set( 'display_errors', 0 );

Editing core Wordpress files is not recommended. They will be overwritten when you update or autoupdate. The correct way to correct for this is to edit the php.ini file on the server and remove ini_set from the disable_functions directive.

You could also set display_errors to Off, or alternatively change the error_reporting directive as well to prevent warnings from being shown.

error_reporting = E_ERROR

You could also try using the error_reporting() PHP function in wp-config.php to try and disable warnings as well.

// Turn off all error reporting
error_reporting(0);

// Only show errors
error_reporting(E_ERROR);

One other suggestion I have never tried to is to override the php.ini values via .htaccess which may or may not work on your host - see this guide.