Title: Block script in the header
Last modified: December 7, 2018

---

# Block script in the header

 *  [EnFi](https://wordpress.org/support/users/enfi/)
 * (@enfi)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/block-script-in-the-header/)
 * Hello [@milmor](https://wordpress.org/support/users/milmor/) and staff,
    is it
   possible to block script by wrapping in this way? <!-COOKIE-BLOCK-START–> <script
   > <!–COOKIE-BLOCK-END–>
 * I want to block a script in my header but if I use the shortcode [cookie][/cookie]
   it appears at the top of the page the grey banner that say to accept cookies.
   And it breaks a little bit the structure of the website, as is in the header.
 * So I’m wondering if is possible to block a script in the header with another 
   code like <!-COOKIE-BLOCK-START–> <!–COOKIE-BLOCK-END–> that doesn’t show the
   banner but only block the script before user accept.
 * Thank you.
    I look forward to hearing from you soon. Kind regards,

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Marco Milesi](https://wordpress.org/support/users/milmor/)
 * (@milmor)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/block-script-in-the-header/#post-11048799)
 * Hi,
    if you want to exclude a script, you can type between <script> and </script
   > the string eucookielaw_exclude. Ex. add class=”eucookielaw_exclude” or a comment.
   [https://wordpress.org/plugins/eu-cookie-law/#faq](https://wordpress.org/plugins/eu-cookie-law/#faq)
 *  Thread Starter [EnFi](https://wordpress.org/support/users/enfi/)
 * (@enfi)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/block-script-in-the-header/#post-11049272)
 * Hi Marco,
    thank you very much for your answer. Now I’ve understood and solved
   the issue. Thank you! Have a great evening! Kind regards,
 *  Thread Starter [EnFi](https://wordpress.org/support/users/enfi/)
 * (@enfi)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/block-script-in-the-header/#post-11049765)
 * Hi [@milmor](https://wordpress.org/support/users/milmor/),
    unfortunately you
   confuse my question and then I tried to follow your advise but it doesn’t work.
 * Your plugin doesn’t block all scripts. I have asked a way to block some scripts
   and you answered a way to EXCLUDE scripts. It is not the same thing!!!
 * If you please read carefully the first post you will see: <<I want to block a
   script in my header but if I use the shortcode [cookie][/cookie] it appears at
   the top of the page the grey banner that say to accept cookies. And it breaks
   the structure of the website, as is in the header.>>
 * So please I’m expecting a way to block a script and not to exclude it!
    Please
   I wasted all the day to try to use the code you told me to use but it is WRONG.
 * I know this support is for free but please a bit of attention to the request.
 * I look forward to hearing from you soon.
    Kind regards,
 *  Plugin Author [Marco Milesi](https://wordpress.org/support/users/milmor/)
 * (@milmor)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/block-script-in-the-header/#post-11049820)
 * The plugin should automatically block scripts if auto block enabled.
    There are
   also php functions to check cookie consent, as written in our faqs.
    -  This reply was modified 7 years, 5 months ago by [Marco Milesi](https://wordpress.org/support/users/milmor/).
 *  Thread Starter [EnFi](https://wordpress.org/support/users/enfi/)
 * (@enfi)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/block-script-in-the-header/#post-11049857)
 * No the plugin doesn’t block scripts like analytic scripts or other if they are
   in the header or in the footer and are integrated through wordrpress theme.
 * For this reason I’ve asked if is possible to tag the script in some way for blocking
   manually. I cannot wrap these scripts with shortcodes as they are not in the 
   wordpress editor.
 * But I can block them if there was a class that instead of say EXCLUDE it says
   INCLUDE eg. class=”eucookielaw_INCLUDE”. Is it possible? It should be an easy
   way.
 * Instead you are suggesting me to put a function on functions.php to check consent
   before running the script is right?
 * Thanks for your collaboration.
 *  Plugin Author [Marco Milesi](https://wordpress.org/support/users/milmor/)
 * (@milmor)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/block-script-in-the-header/#post-11052591)
 * You can also use the functions in your theme templates.
    For example, if the 
   script is in the header.php you can use it 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Block script in the header’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/eu-cookie-law_39293e.svg)
 * [EU Cookie Law for GDPR/CCPA](https://wordpress.org/plugins/eu-cookie-law/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/eu-cookie-law/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/eu-cookie-law/)
 * [Active Topics](https://wordpress.org/support/plugin/eu-cookie-law/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/eu-cookie-law/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/eu-cookie-law/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Marco Milesi](https://wordpress.org/support/users/milmor/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/block-script-in-the-header/#post-11052591)
 * Status: not resolved