Unfortunately, I don’t understand how you converted images into HTML code. To understand your request, would it be possible to provide a link to the website in question?
@threadi I’m assuming they meant the Edit as HTML option that allows one to convert blocks to be edited as HTML. Now using the <img src.. instead of the Media block.
@ann47he1rpjggx6f3yso It would be helpful to provide a link to the page where this is happening so we can help check if there are any CSS overrides going on, as @threadi requested. If you’d like to immediately downgrade to fix this issue and troubleshoot later or on a test site perhaps, here’s a helpful guide to downgrading WordPress: https://kinsta.com/blog/downgrade-wordpress/ or https://www.hostinger.com/in/tutorials/downgrade-wordpress.
Thread Starter
KurtM
(@ann47he1rpjggx6f3yso)
Victor’s response is correct. When I edit the inserted image as HTML, add the custom CSS class, and then click over into an empty area of the post, I get an error and the option to convert to HTML format or back to block format. To maintain the custom CSS class I add, I select the option to convert the image code to HTML format.
Unfortunately, I can’t provide a link because the issue is with my sandbox site, which is not open to the public for obvious reasons. I have not updated WordPress on my live site due to the image alignment issue. Following is an example of the code I usually use when inserting images on my site:
<figure class="wp-block-image aligncenter size-large"><img class="image-margin-default" src="https://www.xyz.net/wp-content/uploads/images/posts/2025/xyz_2025-008-01_faucet--water--supply--connection--original--installation_640x480.jpg" alt=""/></figure>
-
This reply was modified 1 day, 8 hours ago by
KurtM.
-
This reply was modified 1 day, 7 hours ago by
KurtM.
Unfortunately, I still don’t quite understand. How do you insert the HTML code? Do you use the HTML block (which is intended for this purpose) or do you switch to the code editor view? What exactly is the error message you are getting? Feel free to show screenshots of what you see: https://wordpress.org/support/forum-user-guide/block-editor/#adding-screenshots