Let’s know how to disable PHP errors in WordPress. WordPress features a built-in debugging tool that is quite useful for developers. It displays a warning message. This message specifies which file is at fault and which line should be examined. It may occur anytime and involuntarily. For example, changes to your server configuration, database setup, or WP files might all trigger it.

But, from the perspective of a visitor, this appears to be a mess. It’s a WordPress error message that can discourage visitors from returning.

In this article, we’ll discuss how to disable the warning message in WP when debugging. It’s a few lines of code that you may copy and paste into your site.

Also Read :- Best Guide to Fix Failed To Load Resource Error in WordPress

Causes of PHP Error Messages

Outdated plugins or themes cause line warnings in PHP files. In addition, because core files are updated with WordPress upgrades, it renders some code obsolete.

When used with something that is incompatible, themes and plugins can also generate PHP warning messages. In addition, two current plugins that perform well may cause problems when used together. This is because each developer is unique. Also, not everyone develops website files using the same syntax.

Fortunately, these alerts do not always imply that the site is down. To the untrained eye, they appear to be unattractive. These error messages aim to assist developers in troubleshooting problems. Developers release updates to address the warning. But, this is not always the case.

Also Read: Troubleshooting WordPress Errors.

The following are examples of PHP warnings in WordPress:

“/wp-content/plugins/siteplugin.php on line 30”

This does not mean that it is a bad plugin. It could be due to incompatibility with WordPress or another plugin.

Read More: Best Guide to Add an External Link Icon in WordPress

Why and When You Should Disable PHP Errors in WordPress?

Warnings and notifications are the most common PHP problems you’ll see on your WP site. However, internal server issues, syntax errors, and fatal errors do not prevent your website from loading.

Errors such as notices and warnings do not prevent WordPress from loading your website. Instead, these errors are to help developers in debugging difficulties with their code. In addition, the plugin and theme developers need this information to check for compatibility and best practices.

Suppose you aren’t working on a theme, plugin, or custom website. In that case, these errors should be hidden because it looks unprofessional if they appear on the front-end of your site to all your visitors.

Example Image

If you notice an error like the one above on your site, you should contact the theme or plugin provider. They may release a fix that eliminates the problem. In the meantime, you can disable these errors.

Disable the PHP Warnings in WordPress

The following approach involves editing the WordPress wp-config.php file. But, first, let’s learn about WordPress disable warnings and how to disable php warning.

Before making any coding changes, you must make a backup of your site. This will protect you if something goes wrong by allowing you to restore the site.

You can access the wp-config.php file of WordPress through a variety of techniques. However, many individuals prefer to access website resources via FTP programs like FileZilla. Therefore, we are going to use the File Manager in cPanel for this article.

Image Showing File Manager In Cpanel

By clicking the “public html” folder in the directory, you may get to your website.

Image About Click On Public_Html Folder To Access Your Website

“Edit” the wp-config.php file after selecting it. You can find it in File Manager’s top toolbar.

Edit The Wp-Config.php File After Selecting It

On the new window, click the “Edit” button. This is only a notification allowing you to change the editor’s character encoding. This part will not need any modifications.

Click On Edit Button

Scroll down to the line with the following code:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]define(‘WP_DEBUG’, false);[/ht_message]

Find Line Including Code

You may see “true” instead of “false.” This is because you’re looking for the “WP DEBUG” section of the wp-config.php file in either case.

Replace the following code for the previous line:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]ini_set(‘display_errors’,’Off’);

ini_set(‘error_reporting’, E_ALL );

define(‘WP_DEBUG’, false);

define(‘WP_DEBUG_DISPLAY’, false);[/ht_message]

Replace The Line With Code

In the top right corner, click the “Save Changes” button.

Click On Save Changes

The PHP warnings in WordPress will be disabled after saving the file. In addition, it will hide php errors in WordPress.

Read More: Best Guide to Display Random Quotes in WordPress Sidebar

Enable PHP Errors in WordPress

You should enable error reporting if you’re working on a website on your local server or in a staging area. In that scenario, change your wp-config.php file and replace the code you added with the following:

define('WP_DEBUG', true);

define('WP_DEBUG_DISPLAY', true);

With this code, WordPress will display PHP errors, warnings, and alerts once more.


Disable WordPress warnings is only one part of a larger WordPress customization equation. You may make a range of adjustments with a simple copy-and-paste code. However, even if you have no prior knowledge of website building, only make sure you’re copying good code snippets. A website could crash by something that is outdated or built wrong.

We hope that this post has shown you how to disable php errors in WordPress.


Please enter your comment!
Please enter your name here