This post was last updated on June 4th, 2021 at 12:49 pm
define('WP_DEBUG', true);
a WordPress configuration setting. With this setting enabled, WordPress displays all PHP errors, notices, warnings, and also enables WordPress’s deprecated messages. While these messages are an important way to tell developers that certain functions, arguments, or files have been deprecated and that their use is discouraged.
Unfortunately, when a piece of code is marked as deprecated, the offending code or scripts will be raising deprecated messages on the pages. So until we fix the codes we may need to disable these deprecated warning messages. Fortunately, WordPress has some filter hooks that can be used in this scenario. With these hooks, we can alternate the default behavior and how it handles deprecated function messages. Place the following code in you function.php
//How to Disable WordPress Deprecated Warnings add_filter('deprecated_function_trigger_error', 'disable_all_deprecated_warnings'); add_filter('deprecated_argument_trigger_error', 'disable_all_deprecated_warnings'); add_filter('deprecated_file_trigger_error', 'disable_all_deprecated_warnings'); //Not to trigger any errors when a deprecated function or method is called. add_filter( 'deprecated_hook_trigger_error', 'disable_all_deprecated_warnings'); function disable_all_deprecated_warnings($bolean) { return false; }
Leave A Reply