WordPress.org

Ready to get started?Download WordPress

Forums

How to deregister plugin scripts on all but a specified page template (1 post)

  1. agrieveson
    Member
    Posted 2 years ago #

    I have several plugins that load conflicting scripts into wp_head. I am trying to work out how to restrict the plugins to the loading their scripts only on the pages they are required on (eg. all pages with template: template.php). I have got as far as degregisterng them site wide using:

    add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
    
    function my_deregister_javascript() {
    	wp_deregister_script( 'examplescript' );
    }

    I am thinking that I then need to use some sort of negitive version of:

    if (is_page_template( 'tempalte.php' ) ) {

    But am not quite sure how to go about doing this. Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic