How to fix and hidden Warning/ Notices: error in WordPress

Sometime your site make any mistake by code or value: variable is empty, null, themes error, plugins error… WordPress may be display them in your screen. Some times, it is terrible.

How to fix?

You need to check your code and fix them.

Follow message your get, see path file make issue. Open the file with editor and fix it. Usually message error display because variable name get null or empty value. For resolve you need check null/ empty or set default value.

Example:

Warning: Cannot assign an empty string to a string offset in /home/PolyXGO.com/public_html/wp-content/themes/fmmspolygon/options/crawler/sync_data.php on line 16

My code at line 16 is: $this->item[‘url’]=”;

It is normal for empty value but I get a warning by WordPress. So, I will set a default value (if I can) or try{} catch(){} for fix it.

Repeat action for fix all message your get.

How to hidden?

If you are not developer, you can hidden them. For do that, you need to put below config in wp-config.php. Sometime it is ok or no.

define('WP_DEBUG', false);

Refresh website if do not change, update again with below config.

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);

And then, everything ok with your site, good luck!

Related

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.