1
我想注销Wordpress中Disqus评语系统插件的脚本count.js。该脚本是在以下位置:Deregister count.js的评论WordPress的系统插件
/wp-content/plugins/disqus-comment-system/media/js/count.js?ver=4.2.2
我尝试了很多不同的方式,但什么都没有。就像这样:
function prefix_my_scripts() {
wp_deregister_script('count'); /* I tried also 'dsq_count_script' */
}
add_action('wp_enqueue_scripts', 'prefix_my_scripts');
而且也:
function prefix_my_scripts() {
wp_dequeue_script('count'); /* I tried also 'dsq_count_script' */
}
add_action('wp_enqueue_scripts', 'prefix_my_scripts');
我已经看到,插件生成这个脚本是这样的:
wp_register_script('dsq_count_script', plugins_url('/media/js/count.js', __FILE__));
wp_localize_script('dsq_count_script', 'countVars', $count_vars);
wp_enqueue_script('dsq_count_script', plugins_url('/media/js/count.js', __FILE__));
注销后,我想联之前添加脚本身体标记的关闭。
我该怎么做?
您不能从客户端调用PHP函数。为什么不只是注释掉在PHP文件中注册脚本的行呢? –
谢谢你的回答。在WordPress中,我尝试修改插件的文件时出现错误。 – supap