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' );
}
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
https://docs.woocommerce.com/document/conditional-tags/
you can try is_product() its on the woocommerce docs
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0