gab*_*iel 2 php wordpress wordpress-theming wordpress-plugin
我正在尝试删除<STYLE>
内置的Recent Comments小部件放入我的不雅的嵌入式标记<HEAD>
,但我似乎无法正确使用语法.它最初叫
add_action( 'wp_head', array(&$this, 'recent_comments_style') );
Run Code Online (Sandbox Code Playgroud)
添加它(在wp-includes/default-widgets.php,第609行),我正在尝试撤消它.
我认为它应该是这样的:
remove_action('wp_head', 'WP_Widget_Recent_Comments::recent_comments_style');
Run Code Online (Sandbox Code Playgroud)
但是我尝试了所有的变化,我仍然无法做到正确.有谁知道如何实现这一目标?
这是正确的代码:
add_action('wp_head', 'remove_widget_action', 1);
function remove_widget_action() {
global $wp_widget_factory;
remove_action( 'wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style') );
}
Run Code Online (Sandbox Code Playgroud)
但是,由于这个bug,它不起作用.
归档时间: |
|
查看次数: |
3524 次 |
最近记录: |