我运行一个BuddyPress网站,我需要在特定的BuddyPress个人资料页面上注销一个脚本(将avatar更改为更具体)
为了实现这一点,我尝试以下代码
add_action(\'wp_enqueue_scripts\', \'cutting\',100);
$uri = $_SERVER[\'REQUEST_URI\'];
if(strpos($uri,\'/members/\'. the_author() .\'/profile/change-avatar/\') == true){
function cutting() {
wp_dequeue_script( \'bp-legacy-js\' );
wp_deregister_script( \'bp-legacy-js\' );
}
}
不幸的是,它不起作用:-(
有人能帮我吗?
编辑:
add_action(\'wp_enqueue_scripts\', \'cutting\',100);
function cutting() {
$uri = $_SERVER[\'REQUEST_URI\'];
if(strpos($uri,\'members/\'. the_author() .\'profile/change-avatar\') == true){
wp_register_style( \'connected4\', get_stylesheet_directory_uri() . \'/connected4.css\' );
wp_enqueue_style( \'connected4\' );
}
}
我想这部分一定有问题
if(strpos($uri,\'members/\'. the_author() .\'profile/change-avatar\') == true)
最合适的回答,由SO网友:Neoseeyou 整理而成
好的,最后我使用bp\\u is\\u change\\u avatar找到了解决方案
add_action(\'wp_enqueue_scripts\', \'cutting\',100);
function cutting() {
if(bp_is_change_avatar()){
wp_dequeue_script( \'XXX );
}
}
谢谢大家的帮助