• I have been having this issue for a while. And I just can’t figure it out. I keep trying to add an Amazon affiliate link to my posts using the Custom HTML code block. But when I insert the code and then go to preview it, it’s blank. What could possibly be causing this to happen? I’m trying to add a product image from Amazon.

    I am not a coder, so this is all new to me. But based on all the tutorials I’ve viewed, adding code using this block should be simple and straight forward. I even tried deactivating all my plug-ins and reverting to the basic Twenty-Twenty theme. I am still having the same issue.

    Any help would great. Please let me know what other information I can provide.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The editor will filter what you put in the content based on your user role and capabilities. You have to have the unfiltered_html capability (which is by default given to admin role) to put scripts into the editor. If you have this, perhaps Amazon won’t show an ad for its own affiliate, or you have an ad blocker extension in your browser?

    Thread Starter stubbs122008

    (@stubbs122008)

    @joyously Thanks. I’ve confirmed that I have unfiltered_html capability. So it must be something wrong with the amazon code. I don’t have an adblocker extension, so it’s not that either.

    So when you put the code in the editor and save, get out and come back in, is the code in there? Or is it just producing nothing on the preview? The point is to try to narrow down where the problem is, in the save or in the display.

    Thread Starter stubbs122008

    (@stubbs122008)

    @joyously After I put the code in the editor, save, get out and come back in, the code is still there. But the preview is still completely blank.

    That tells you that the editor is working, saving what you entered, and showing it to you when you get in the editor again.
    The problem is the code isn’t working like you want. Did you put “code” into Visual mode? Are there strange characters, like the backtick instead of a single quote or a texturized quote instead of a double quote? Are there errors in the javascript console (use the browser Developer Tool to see).

    Thread Starter stubbs122008

    (@stubbs122008)

    @joyously Yes, I put code in visual mode, or at least I think I know what you mean by that. There is the visual editor and code editor mode, and I’ve tried both if that’s what you mean. I just took a look at the javascript console. This is all a bit foreign to me, to say the least. But it looks like there is an error. It shows the following:

    [DOM] Found 2 elements with non-unique id post.php?post=769&action=edit:1
    #_wpnonce: (More info: https://goo.gl/9p2vKq)
    <input type=”hidden” id=”_wpnonce” name=”_wpnonce” value=”37b7110dd3″>
    <input type=”hidden” id=”_wpnonce” name=”_wpnonce” value=”46a1d39269″>

    Could this have something to do with it?

    I suppose since it’s a Custom HTML block, it isn’t really in Visual mode. But it shouldn’t have the fancy quotes, just normal quotes (that are on the keyboard).

    Well, in HTML, IDs are supposed to be unique, so that a part of the HTML is specifically targeted. Having two inputs with the same ID is not good at all. The _wpnonce name is a standard, sort of default, name given to the security token. If you have a plugin that is using the default (or two of them), then I suppose it might cause a problem with the preview, but I don’t know if the editor itself is using the default.
    Perhaps you can try using the Health Check plugin in Troubleshoot mode, to disable plugins for your user only, to see if it still happens without the plugins. If it does, you can enable one at a time to see which one it is. If it’s WP and not the plugins (or theme), then we can report it to the editor team.

    Thread Starter stubbs122008

    (@stubbs122008)

    @joyously Just looking back and realized I didn’t close this out. Thanks again for your help. It turns out I have an ad-blocker after all through my virus protection. Trying to figure out how to turn it off! But I’m pretty sure that’s the issue.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custom HTML Code Block Not Working’ is closed to new replies.