Created
January 2, 2023 18:55
-
-
Save mohsinrasool/60c59a31fc5246d5774ef77054f6f44f to your computer and use it in GitHub Desktop.
This WordPress mu-plugin disables php deprecated messages and warnings,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Disable PHP warnings | |
Description: This plugin disables php deprecated messages and warnings, | |
Version: 0.1 | |
Author: mohsinrasool | |
Author URI: https://mohsinrasool.pk | |
*/ | |
// ini_set('display_errors', 'Off'); | |
// ini_set('display_startup_errors', 0); | |
// ini_set('error_reporting', 0); | |
// error_reporting(0); | |
// define('WP_DEBUG', false); | |
// define('WP_DEBUG_DISPLAY', false); | |
function meti_disable_php_warnings() { | |
ini_set('display_errors', 'Off'); | |
ini_set('display_startup_errors', 0); | |
ini_set('error_reporting', E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_USER_DEPRECATED & ~E_WARNING & ~E_STRICT); | |
// error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_USER_DEPRECATED & ~E_WARNING); | |
} | |
// add_action( 'init', 'meti_disable_php_warnings' ); | |
add_action( 'plugins_loaded', 'meti_disable_php_warnings' ); | |
// add_action( 'setup_theme', 'meti_disable_php_warnings' ); | |
// add_action( 'muplugins_loaded', 'meti_disable_php_warnings' ); | |
// add_action( 'wp_loaded', 'meti_disable_php_warnings' ); | |
// add_action( 'wp_head', 'meti_disable_php_warnings' ); | |
// add_action( 'wp', 'meti_disable_php_warnings' ); | |
// add_action( 'wp_loaded', 'meti_disable_php_warnings' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment