{"id":7,"date":"2019-09-14T09:55:09","date_gmt":"2019-09-14T09:55:09","guid":{"rendered":"http:\/\/sumitjangid.com\/?p=7"},"modified":"2019-09-14T09:55:09","modified_gmt":"2019-09-14T09:55:09","slug":"remove-all-styles-for-certain-page-template","status":"publish","type":"post","link":"http:\/\/sumitjangid.com\/index.php\/2019\/09\/14\/remove-all-styles-for-certain-page-template\/","title":{"rendered":"Remove all styles for certain page template?"},"content":{"rendered":"\n<p> You can remove specific styles and java scripts for specific page template like below. Add the code into the\u00a0<code>functions.php<\/code>\u00a0file of your current theme. To see the list of all JS and CSS you may want to use a plugin like this:\u00a0<a href=\"https:\/\/wordpress.org\/plugins\/debug-bar-list-dependencies\/\">https:\/\/wordpress.org\/plugins\/debug-bar-list-dependencies\/<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n * Remove specific java scripts.\n *\/\nfunction se_remove_script() {\n    if ( is_page_template( 'blankPage.php' ) ) {\n        wp_dequeue_script( 'some-js' );\n        wp_dequeue_script( 'some-other-js' );\n    }\n}\n\nadd_action( 'wp_print_scripts', 'se_remove_script', 99 );\n\n\/**\n * Remove specific style sheets.\n *\/\nfunction se_remove_styles() {\n    if ( is_page_template( 'blankPage.php' ) ) {\n        wp_dequeue_style( 'some-style' );\n        wp_dequeue_style( 'some-other-style' );\n    }\n}\n\nadd_action( 'wp_print_styles', 'se_remove_styles', 99 );<\/code><\/pre>\n\n\n\n<p>You can remove all styles and java scripts in one go for specific page template like below. Add the code into the&nbsp;<code>functions.php<\/code>&nbsp;file of your current theme.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n * Remove all java scripts.\n *\/\nfunction se_remove_all_scripts() {\n    global $wp_scripts;\n    if ( is_page_template( 'blankPage.php' ) ) {\n        $wp_scripts->queue = array();\n    }\n}\n\nadd_action( 'wp_print_scripts', 'se_remove_all_scripts', 99 );\n\n\/**\n * Remove all style sheets.\n *\/\nfunction se_remove_all_styles() {\n    global $wp_styles;\n    if ( is_page_template( 'blankPage.php' ) ) {\n        $wp_styles->queue = array();\n    }\n}\n\nadd_action( 'wp_print_styles', 'se_remove_all_styles', 99 );<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can remove specific styles and java scripts for specific page template like below. Add the code into the\u00a0functions.php\u00a0file of your current theme. To see the list of all JS and CSS you may want&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,7],"tags":[],"_links":{"self":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts\/7"}],"collection":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":1,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":8,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts\/7\/revisions\/8"}],"wp:attachment":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/media?parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/categories?post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/tags?post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}