Adding media in Code Editor
-
Is there a way to add media in Code Editor (CE)? Finding myself apparently trapped in the horrible Block Editor, I use CE – but with no CE toolbar, there’s no way to insert media.
Warning<nstrong>: don’t think you can switch to Visual Editor (VE), insert media, then switch back to CE. Doing that stripped out my internal anchor “<a id…” code.
This is my workaround:
• Open dummy post. In VE, insert media
• Change to CE. Copy code.
• Paste into orig post
• Delete dummy postIs there an easier, safe, method?
The blog I need help with is: (visible only to logged in users)
-
-
Hi there,
It’s possible to add media via the code editor, but you’d have to use the correct block markup for an image block to do it – you can’t just use a plain HTML
imgtag.If you prefer to manually code your contents using HTML, I’d recommend you use the HTML block instead, rather than the code editor view of the blog editor itself:
-
Thanks for that. But I don’t want to use blocks at all. I find it too limiting. Also:
“For security reasons, not all HTML tags are allowed in the Custom HTML Block. Please check the list of supported HTML tags for the ones you can use.”
The list doesn’t include “id”.
-
Presumably, that’s why my “id” code was stripped out when I went from Code Editor to Visual Editor and then back to Code Editor.
-
I’d recommend adding a block, viewing that code, then using that as a template for adding your HTML going forward. Mine looks something like this:
<!-- wp:image {"id":5391,"sizeSlug":"large"} --> <figure class="wp-block-image size-large"><img src="...And so on.
Also, could you send a link to the site you’re working on, preferably the page or post so we can see what you’re hoping to do?
Note these forums are for the sites hosted and managed here at WordPress.com. For help with a WordPress installation hosted somewhere else, you’ll need to use these forums instead:
- The topic ‘Adding media in Code Editor’ is closed to new replies.