Inbuiltweb is a cutting-edge website and application development company that aims to bring a secure and organized internet to everyone through the development of standard platforms that automate manual labour with web technology.
Why and when you should turn Off PHP eerrors in WordPress? The common PHP errors you can see on the front-end of your WordPress website are usually for warnings, notices, and displaying to ease debugging process. These are not like internal server error, syntax errors, or fatal errors, which stop your website from loading, but it is unprofessional to display these errors to your users. Notices and warnings are the kind of errors that do not stop WordPress from loading your website but displays the errors to your audience instead.
The purpose of these errors are to help developers debug issues with their code. Plugin and theme developers need this information to check for compatibility and best practices. However, if you are not developing a theme, plugin, or a custom website, then these errors should be hidden. Because if they appear on the front-end of your website to all your visitors, it looks extremely unprofessional.
Let us take a look at how to easily turn off PHP errors, notices, and warnings in WordPress. Turning off PHP Errors in WordPress For this part, you will need to edit the wp-config.php file. Inside your wp-config.php file, look for the following line: define('WP\_DEBUG', true); It is also possible, that this line is already set to false. In that case, you will see the following code: define('WP\_DEBUG', false); In either case, you need to replace this line with the following code:
ini\_set('error\_reporting', E\_ALL );
Do not forget to save your changes and upload your wp-config.php file back to the server. You can now visit your website to confirm that the PHP errors, notices, and warnings have disappeared from your website. Turning on PHP Errors on WordPress If you are working on a website on local server or staging area, then you may want to turn on error reporting. In that case you need to edit your wp-config.php file and replace the code you added earlier with the following code:
This code will allow WordPress to start displaying PHP errors, warnings, and notices again. If you found this content helpful, share to your friends and do let us know your opinion on the comments section below.