<?php
/*
Plugin Name: My add_contextual_help
Description: Wrap add_contextual_help() to turn off debug warnings.
License: GPL2
*/
// The easiest place to put this is in wp-content/mu-plugins/.
// See: http://codex.wordpress.org/Must_Use_Plugins
$my_add_contextual_help_id= 0;
/////////////////////////
function my_add_contextual_help($screen, $help) {
//////////////////////////
// Stop 'deprecated' warnings in WP debug mode:
//////////////////////////
// "Notice: add_contextual_help is <strong>deprecated</strong> since version 3.3!
// Use get_current_screen()->add_help_tab() instead. in ...wp-includes/functions.php on line 3458"
//////////////////////////
// Fix based on '../themes/twentyeleven/inc/theme-options.php'
// and '../../wp-admin/includes/deprecated.php'
//////////////////////////
global $my_add_contextual_help_id;
if ( is_string( $screen ) ) {
$screen = convert_to_screen( $screen );
}
if (method_exists( $screen, 'add_help_tab' ) ) {
// WordPress 3.3
$my_add_contextual_help_id++;
$screen->add_help_tab( array(
'title' => __( 'Overview' ),
'id' => 'myaddcontextualhelp'.$my_add_contextual_help_id,
'content' => $help,
)
);
// $screen->set_help_sidebar( $help );
} elseif (function_exists( 'add_contextual_help' ) ) {
// WordPress 3.2
add_contextual_help( $screen, $help );
}
}
?>