How can I stop PHP notices from appearing in wordpress?

I know about error_reporting(0);, and ini_set('display_errors', false);, but there is a notice appearing in wordpress:

Notice: Array to string conversion in /var/www/vhosts/treethink.net/subdomains/parkridge/httpdocs/wp-includes/formatting.php on line 359

Read More

it only appears in wordpress, not in any other pages of the site.

I checked phpinfo(), and everything is set so that errors are not displayed. Why does this one still show up?

Here is the line that generates the error:

function wp_check_invalid_utf8( $string, $strip = false ) {
    $string = (string) $string;

I did change some thing in wordpress, to change how the gallery worked. But not this function, and I don’t think I changed any calls to this function either. Aside from the notice appearing, everything seems to operate perfectly fine, I just need to get this error to hide.

Related posts

Leave a Reply

6 comments

  1. You need to edit your:

    wp-config.php
    

    file and modify the following here:

    error_reporting(0);
    @ini_set('display_errors', 0);
    

    otherwise WordPress overwrites the ALERTS set by PHP.INI

  2. Jan 2015 with latest WordPress, none of the above works for me.

    Creating a php file in mu-plugins folder of WordPress worked, like :

    <?php
    error_reporting(E_ALL &  ~( E_NOTICE | E_USER_NOTICE | E_STRICT | 
    E_DEPRECATED | E_USER_DEPRECATED | E_WARNING | E_CORE_WARNING | 
    E_USER_WARNING | E_COMPILE_WARNING | E_PARSE )); 
    

    Just name it anything you want …

    i got the answer from here :

    https://wycks.wordpress.com/2013/12/05/how-to-remove-error-notices-using-wordpresss-wp_debug/

  3. Most of the time these are nothing to worry about (though the plugin/theme developer should know about these so that they may fix them in a future release). PHP warnings and notices are nothing to worry about on a production site most of the time.
    Some of these can even be generated because the developer has to keep compatibility with older versions of WordPress as well as older PHP versions.

    define('WP_DEBUG', false);
    

    with this

    ini_set('log_errors','On');
    ini_set('display_errors','Off');
    ini_set('error_reporting', E_ALL );
    define('WP_DEBUG', false);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    

    If you simply set WP_DEBUG to false in your wp-config.php file you should be fine. These don’t affect your site in any way.

    However, the problem is that some times the above does not work.
    That can happen most times on cheap shared hosts that force displaying PHP warnings and notices.
    In that case, you can replace this line from your wp-config.php file:

  4. /**
     * For developers: WordPress debugging mode.
     *
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
     */
    define('WP_DEBUG', false);
    
    // Enable Debug logging to the /wp-content/debug.log file
    define('WP_DEBUG_LOG', false);
    
    // Disable display of errors and warnings 
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors', 0);
    

    What I use and it works with the latest WordPress version.