Skip to content

Instantly share code, notes, and snippets.

@mohsinrasool
Created January 2, 2023 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohsinrasool/60c59a31fc5246d5774ef77054f6f44f to your computer and use it in GitHub Desktop.
Save mohsinrasool/60c59a31fc5246d5774ef77054f6f44f to your computer and use it in GitHub Desktop.
This WordPress mu-plugin disables php deprecated messages and warnings,
<?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