Skip to content

Instantly share code, notes, and snippets.

@MogulChris
Created March 25, 2020 23:36
Show Gist options
  • Save MogulChris/5abfe283bd3a4ccc16e4a6d013ff0c30 to your computer and use it in GitHub Desktop.
Save MogulChris/5abfe283bd3a4ccc16e4a6d013ff0c30 to your computer and use it in GitHub Desktop.
WordPress - disable warnings about a specific function
<?php
//Since 5.3 WordPress spits out this notice: add_submenu_page was called incorrectly. The seventh parameter passed to add_submenu_page() should be an integer representing menu position.
//I've fixed my own plugins, but it's still coming from a WP Engine mu-plugin which I can't fix or disable, and I still want WP_DEBUG_DISPLAY enabled so I can see other errors and warnings.
//Solution: apply_filters( 'doing_it_wrong_trigger_error', true, $function, $message, $version )
function mf_hide_annoying_notice($a, $function) {
if($function == 'add_submenu_page') return false;
}
add_filter('doing_it_wrong_trigger_error','mf_hide_annoying_notice',10,2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment