Advertisement
kitchin

my_add_contextual_help

Dec 16th, 2011
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: My add_contextual_help
  4. Description: Wrap add_contextual_help() to turn off debug warnings.
  5. License: GPL2
  6. */
  7.  
  8. // The easiest place to put this is in wp-content/mu-plugins/.
  9. // See: http://codex.wordpress.org/Must_Use_Plugins
  10.  
  11. $my_add_contextual_help_id= 0;
  12. /////////////////////////
  13. function my_add_contextual_help($screen, $help) {
  14.  
  15.   //////////////////////////
  16.   // Stop 'deprecated' warnings in WP debug mode:
  17.   //////////////////////////
  18.   //   "Notice: add_contextual_help is <strong>deprecated</strong> since version 3.3!
  19.   //     Use get_current_screen()->add_help_tab() instead. in ...wp-includes/functions.php on line 3458"
  20.   //////////////////////////
  21.   // Fix based on '../themes/twentyeleven/inc/theme-options.php'
  22.   // and '../../wp-admin/includes/deprecated.php'
  23.   //////////////////////////
  24.  
  25.   global $my_add_contextual_help_id;
  26.   if ( is_string( $screen ) ) {
  27.     $screen = convert_to_screen( $screen );
  28.   }
  29.   if (method_exists( $screen, 'add_help_tab' ) ) {
  30.     // WordPress 3.3
  31.     $my_add_contextual_help_id++;
  32.     $screen->add_help_tab( array(
  33.         'title' => __( 'Overview' ),
  34.         'id' => 'myaddcontextualhelp'.$my_add_contextual_help_id,
  35.         'content' => $help,
  36.         )
  37.     );
  38.     // $screen->set_help_sidebar( $help );
  39.   } elseif (function_exists( 'add_contextual_help' ) ) {
  40.     // WordPress 3.2
  41.     add_contextual_help( $screen, $help );
  42.   }
  43. }
  44.  
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement