[QUESTION] Manually Add Image Dimensions to WordPress

Roger Marquez

Elite Member
Executive VIP
Jr. VIP
Joined
Apr 17, 2017
Messages
5,073
Reaction score
7,736
Guys, this might be a "newbie" level question for most of you and I know there are plugins that do this automatically but, I prefer the manual approach (if I can).

How I can edit the HTML in order to specify/change/add the dimensions to a particular image in WordPress?

I am having some CLS issues and WP Rocket is not working properly in this regard.

I have access to the site Cpanel so...?

Thoughts?
 
The easiest solution is to just resize and optimize the image even before uploading it. But if you want to html code for width and height, it's something like this: <img src="url of the picture" alt="alt text" width="set here" height="set here">
 
<img src="url of the picture" alt="alt text" width="set here" height="set here">
I am aware of the code needed to do this, it´s all over the internet my question is how can I edit the HTML of a site in order to add THAT code and potentially avoid issues like this...

e70d42c497e6006115b722450e412fa5.png

By the way, the site is using WP Rocket and these images are for the site´s logo inserted through Elementor > Theme Builder > Header.

I´ve excluded the images from lazy loading but, still, I am struggling to address this.

This just seems like an easy fix and I would like to avoid having to install a plugin for this.​
 
Last edited:
Back
Top