How to remove help tabs?

All we need is an easy explanation of the problem, so here it is.

Is there any way to remove the help tabs?
I’m looking to remove these tabs not to hide them with CSS.

On the wp-admin/includes/screen.php there are a couple of lines that mention this but no idea how to create something to remove the help tab.

Is there any way to create something similar to: add_filter('screen_options_show_screen', '__return_false'); but to remove the Help tab ?

From the screen.php file:

 647      /**
 648       * Removes a help tab from the contextual help for the screen.
 649       *
 650       * @since 3.3.0
 651       *
 652       * @param string $id The help tab ID.
 653       */
 654    public function remove_help_tab( $id ) {
 655          unset( $this->_help_tabs[ $id ] );
 656      }
 657  
 658      /**
 659       * Removes all help tabs from the contextual help for the screen.
 660       *
 661       * @since 3.3.0
 662       */
 663    public function remove_help_tabs() {
 664          $this->_help_tabs = array();
 665      }

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

You need to use the contextual_help help filter.

add_filter( 'contextual_help', 'wpse50723_remove_help', 999, 3 );
function wpse50723_remove_help($old_help, $screen_id, $screen){
    $screen->remove_help_tabs();
    return $old_help;
}

The filter is for the old context help (pre 3.3). (I’m not sure it matters what is returned…?).

In any case the filter should be called late (hence 999) because plug-ins could add their own help tabs to pages. This is partly why admin_head is not an ideal hook.

Method 2

Add this you your functions.php file:

add_action('admin_head', 'mytheme_remove_help_tabs');
function mytheme_remove_help_tabs() {
    $screen = get_current_screen();
    $screen->remove_help_tabs();
}

This will remove tabs ant the ‘Help’ button from all admin pages.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply