2012-05-01 58 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(); 
} 

但第一个选项是安全的一个