[Support request] Generic adsense code disappears from head

Home Forums Support Generic adsense code disappears from head

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1489681

    I use a plugin to insert the adsense ads but when I insert in the head the adsense code disappears after a short time. It only happens to me in generatepress, in other themes I have no problem.
    How can I create a general hook to insert the generic adsense code and not delete it automatically? Is there a way that the adsense code does not disappear from the template?

    Customer Support

    Hi there,

    there isn’t anything in GP that would affect the behaviour of that plugin. I would assume the plugin is adding code to core WP hooks which again GP has no awareness of or control over.

    If you know where the code needs to be added you can use a Hook Element:


    There are 3 main hooks for adding scripts to WP:

    wp_head – inside the <head></head>
    wp_body_open – immediately after the opening <body> tag
    wp_footer – in the footer

    For ad placement codes there is a number of Theme hooks which you can see in the visual guide:



    Thanks David,

    I have created a hook in wp_head that affects the whole site, this is how the main adsense script is executed, for now it works correctly,


    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.