Question

i want to remove a specific js file from specific template. i have seen sone solutions and try them but got no result. following i am writing the code which i tried.

add_action('wp_enqueue_scripts','theme_slug_dequeue_footer_jquery');
function theme_slug_dequeue_footer_jquery() {
   
     if ( is_page_template('property_list_half.php') ) {
       wp_dequeue_script('directory-js');
       wp_deregister_script('directory-js');
     }      
   }

following the image of file i want to remove

Was it helpful?

Solution

Try this out. The -js is added by WordPress, so you don't need it when you are calling it.

function theme_slug_dequeue_footer_jquery() {

    if ( is_page_template('property_list_half.php') ) {
        wp_dequeue_style( 'directory' );
    }
}
add_action('wp_enqueue_scripts','theme_slug_dequeue_footer_jquery');
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top