• Resolved pranavmahapatra

    (@pranavmahapatra)


    I have been using the HTML block in the post editor to manually place in AdSense ads. The code starts with:

    <script async src="https...

    WordPress has been lately messing it up by changing the code, it ads =”” after the keyword async, like this:

    <script async="" src="https...

    You can test this by adding the following HTML block:

    <script async src="https://somelink.do" crossorigin="anonymous"></script>

    Save the post, and then copy-paste (not duplicate) the block or revisit/refresh the post editor.

    Although I had thought about automating this process of placing ads (not by auto ads), this issue made me realize, this is the time to implement it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m unable to reproduce this on a fresh WordPress 6.1.1 site with the default theme and NO PLUGIN installed. Please see the screen recording below.

    It seems it’s some issue on your site.

    (If I didn’t take the correct steps to reproduce the error, please let me know and I’d be happy to do it again.)

    UPDATE:

    Watching the video, I realized my screen recording didn’t show the browser’s toolbar and address bar, so you don’t see me refreshing the page. But you’ll have to trust me on this: I refreshed the editor page several times, even left the screen all together to the ALL POSTs screen and came back.

    Thread Starter pranavmahapatra

    (@pranavmahapatra)

    No, you used the wrong code, it has async=”” already.

    The right one is where it’s just async, WordPress changes it to async =””

    Use this or something similar to it,

    <script async src="https://somelink.do"></script>

    Then copy the block using the copy block option under the “three dots”, and then paste it.

    You’ll see async will be changed to async=””

    Alternatively, not doing the copy-paste block thing, just have the code on the post, save it, and then refresh/revisit the post, you’ll see the same – async will change to async=””

    Note that I was able to reproduce this without any plugins working on the site.

    Sorry I grossed over that, because:

    <script async src="https://somelink.do"></script>

    and

    <script async="" src="https://somelink.do"></script>

    … are equivalent, so I didn’t really understand this was the “problem” you were reporting.

    This is NOT a problem. If something is not working on your site, the problem is elsewhere.

    According to the HTML technical standard:

    Empty attribute syntax

    Certain attributes may be specified by providing just the attribute name, with no value.

    In the following example, the disabled attribute is given with the empty attribute syntax:

    <input disabled>

    Note that empty attribute syntax is exactly equivalent to specifying the empty string as the value for the attribute, as in the following example.

    <input disabled="">

    • This reply was modified 1 year, 9 months ago by George Appiah. Reason: Added W3C reference
    Thread Starter pranavmahapatra

    (@pranavmahapatra)

    Why did no one tell me async is the same as async=””

    ;-; So sorry for the trouble and thank you so much for mega humble support. I thought it’s not equivalent, and that’s why the ads weren’t loading, but it was related to caching.

    Thank you so much George.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Issue with HTML blocks inside the Post Editor’ is closed to new replies.