如果要将脚本出列(&W);基于slug 页的。你可以通过各种方式获得slug,并使用它代替$_SERVER[\'REQUEST_URI\']
.
使用if( is_page( array( \'my_page\')
而不是if(basename($_SERVER[\'REQUEST_URI\'])==\'my_page\')
function wpse_289574_dequeue_scrips() {
if(is_page( array( \'my_page\')){
wp_dequeue_style( \'taxonomy-image-plugin-public\' );
...
}
}
How to get the slug of a page:
$qo = $GLOBALS[\'wp_the_query\']->get_queried_object();
$cp = sanitize_post($qo);
$slug = $cp->post_name;
摘自:
How to retrieve the slug of current page?function wpse_289574_dequeue_scrips() {
if($slug ==\'my_page\'){
wp_dequeue_style( \'taxonomy-image-plugin-public\' );
...
}
}
当前出列挂钩为
wp_enqueue_scripts
.