Support » Plugin: Redirection for Contact Form 7 » Enable JS only in form pages

  • Resolved weblv

    (@weblv)


    Hi,
    Is it possible to enqueue this plugin javascript only in the contact form pages?
    Thanks

Viewing 1 replies (of 1 total)
  • Plugin Author yuvalsabar

    (@yuvalsabar)

    Hi @weblv,

    Yes, you can, but you’ll have to do it manually. For example, if you have a contact form in a page with id of 30, you can use this code to dequeue scripts from all pages except this one.

    function qs_dequeue_script() {
    	if ( ! is_page(30) ) {
       		wp_dequeue_script( 'wpcf7-redirect-script' );
    	}
    }
    add_action( 'wp_print_scripts', 'qs_dequeue_script', 100 );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.