0

I tried to use the code below in version 4.0 of my wordpress and you can not load the file you wish only a specific page. Is there any way to do this with other code?

The plugin in question is the Multi-column Tag Map

function wpa_scripts() {
// if this is not the contact page, remove the script
if( ! is_page( '' ) ){
    wp_dequeue_script('');
}
}
// adjust priority to make sure this runs after the plugins add their scripts/styles
add_action( 'wp_enqueue_scripts', 'wpa_scripts', 100 );
1
  • Remove the ! operator. if( ! is_page( '' ) ) means in plain English, if we are not on a page, then do something. You would want to change this to if( is_page( 'PAGE_ID' ) ) which means if we are on page PAGE_ID, do something Apr 14, 2015 at 4:22

1 Answer 1

1

Just one thing to make sure of, you must put the page id in the brackets for the "is_page()" function. If your page ID was 12, you'd use it like this:

if( ! is_page( 12 ) ){

You can find a page's id by editing it and looking in the URL for "post=". The Page ID will be directly after the "=" sign in the address bar.

2
  • Hello, i know that, even used in the code, but it did not work. The script remained active for all other pages and posts.
    – Rafael
    Apr 14, 2015 at 2:54
  • Update your question with your new code changes. Apr 14, 2015 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.