• meg22

    (@meg22)


    I am trying to add custom HTML google ad sense code to my posts but for some reason when I update the HTML code and hit ‘update’ in the editor, it doesn’t save anything.
    Please help!

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • threadi

    (@threadi)

    I suspect it is related to the HTML code. If you just write “aaaa” in the block, it should save that? If so, please show us the code you want to insert.

    Thread Starter meg22

    (@meg22)

    Yes, if I type “aaaa” in the Custom HTML block, that gets saved but this code doesn’t. Below is the code I am trying to add to my blog posts.


    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8433820237922312"
         crossorigin="anonymous"></script>
    <!-- Blogpost Square -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-8433820237922312"
         data-ad-slot="4672949974"
         data-ad-format="auto"
         data-full-width-responsive="true"></ins>
    <script>
         (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    threadi

    (@threadi)

    I can insert the code without any problems. So it could be because of some plugin and also your theme. Deactivate all plugins and try it this way. Then activate piece by piece until it no longer works.

    Thread Starter meg22

    (@meg22)

    I deactivated all plugins and then tried to add this code, but it still doesn’t work.

    threadi

    (@threadi)

    That is strange. I have a pure wordpress installation without any plugins and default theme. This works without any problems. So in the sense of: Code is saved and output in the frontend.

    In your page I see the code, but it is not executed by the browser for security reasons. Reason: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSDidNotSucceed

    You also seem to have a JavaScript error in your page. It is caused in this line:

    jQuery(".cfx_form_main,.wpcf7-form,.wpforms-form,.gform_wrapper form").each(function(){

    Looks like a custom addition to me. It would have to be loaded later, after jQuery is included. This error could prevent your new code from running as well.

    Thread Starter meg22

    (@meg22)

    When I add the HTML code I can preview it. See screenshot below.

    https://drive.google.com/file/d/1o5Rkee7I9xoU2VIWzQSOnMWjfT_ku1cT/view?usp=sharing

    But when I hit update – it doesn’t save anything.
    I am using Astra free theme on the website if that helps?

    threadi

    (@threadi)

    Is there no error message? And yes, the theme could also interfere with this.

    Thread Starter meg22

    (@meg22)

    No there is no error message. I tried to use a different browser as well so that I don’t have an ad blocker or issues like that.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘custom HTML not working in Posts’ is closed to new replies.