-2

I would like to hide a script, an ad actually from a specific post. The script is placed on header. I am a rookie here so please help!

  • 1
    Hi nikam, welcome to WPSE. We're going to need some more information to help you and it will need you to dig into the code for your Wordpress install (this is the Wordpress Development stack exchange, after all :) ). How is the script being added? Where in the source code is it? Have you tried searching through your theme's files and/or disabling plugins one by one to see where it comes from? – Tim Malone Jun 15 '16 at 23:07
1

You can do something like this :

// remove the script from the queue if were are on the post ID 11
add_action('wp_enqueue_scripts', 'remove_script_specific_post');
function remove_script_specific_post(){
    if( 11==get_the_ID() ){
        wp_dequeue_script('my_script_handle'); 
    }
}

Provided that the script has been added with wp_enqueue_script

| improve this answer | |

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