Help detecting when it's a post, page and category page
-
Hey guys i’m doing some tweaks to speed up my website website. I’m just having some troubles detecting when it’s a post and category page. What i’m doing is test if the user is not on a post,page or category page to run the code to disable the plugin’s css.
So far i’ve tried a few options but only when they’re on a page “is_page()” that’s only when the code works. I’m still trying to figure out how to detect if its a post and categories this is my current code so far:
function remove_scripts() { if ( is_page() || is_single() ) { wp_dequeue_style( 'plugin-style' ); wp_dequeue_script( 'plugin-js' ); } }
I’ve also tried “is_singular(‘post’)” instead of is_single but none of both seem to work. Any ideas how to detect if it’s a post and how to detect if it’s a category page? Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Help detecting when it's a post, page and category page’ is closed to new replies.