admin管理员组文章数量:1323732
I'm trying to dequeue some scripts on woocommerce product, but for some reason I can’t find a way to check for a single product.
is_singular('product')
doesn't work for some reason. The dequeue itself works without the checks, e.g.:
add_action( 'wp_enqueue_scripts', 'my_custom_scripts', 100 );
function my_custom_scripts()
{
wp_deregister_script( 'wp-mediaelement' );
wp_deregister_style( 'wp-mediaelement' );
}
I'm trying to dequeue some scripts on woocommerce product, but for some reason I can’t find a way to check for a single product.
is_singular('product')
doesn't work for some reason. The dequeue itself works without the checks, e.g.:
add_action( 'wp_enqueue_scripts', 'my_custom_scripts', 100 );
function my_custom_scripts()
{
wp_deregister_script( 'wp-mediaelement' );
wp_deregister_style( 'wp-mediaelement' );
}
Share
Improve this question
edited Sep 13, 2020 at 23:31
fuxia♦
107k38 gold badges255 silver badges459 bronze badges
asked Sep 13, 2020 at 16:33
RunnickRunnick
1,0593 gold badges14 silver badges26 bronze badges
1
- I believe it's too early to use the conditional functions in that hook – Tom J Nowell ♦ Commented Sep 14, 2020 at 8:25
1 Answer
Reset to default 1https://docs.woocommerce/document/conditional-tags/
you can try is_product()
its on the woocommerce docs
本文标签: How to dequeue script on woocommerce product
版权声明:本文标题:How to dequeue script on woocommerce product? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742122011a2421756.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论