2012-05-01 34 views
1

wordpressのヘルプタブを削除する方法はありますか? これらのタブを削除して、CSSで非表示にしないようにしています。Wordpressのヘルプタブを削除

wp-admin/includes/screen.phpには、これに言及する行がいくつかありますが、ヘルプタブを削除する方法を作成する方法はありません。

add_filter('screen_options_show_screen', '__return_false');と似たようなものを作成する方法はありますか?ヘルプタブを削除するにはどうすればよいですか?

screen.phpファイルから:

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  } 
+0

http://wordpress.stackexchange.com – chrisjlee

答えて

2

あなたはcontextual_helpヘルプフィルターを使用する必要があります。

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; 
} 

フィルタは古いコンテキストヘルプ(3.3より前)用です。 (私は返されるものが重要であるとは確信していません...?)。

いずれの場合でも、プラグインは独自のヘルプタブをページに追加できるため、フィルタを遅く呼び出す必要があります(したがって999)。これは部分的にadmin_headが理想的なフックではない理由です。

また、これは、同様

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

を動作しますが、最初のオプションは安全です

あなたは試してみてください
関連する問題