Find the File URL in WordPress
Great advantages come from taking the occasional risk. Putting yourself out on a limb, taking a little more control. Even a little risk, like trying your hand at inserting an image with straight HTML, might just reward you with something greater in the long run. For instance; more control over your website.
Here’s how to start off that journey by finding the file path to media in WordPress.
The first step is to upload your image to the media library. Once your image is loaded, you can hover over the thumbnail to find the Edit, Delete, and View options.
You’re going to click Edit.
Now, you’ll see the “Edit Media” page. Circled in red below, you can see the File URL. Copy that – make sure you get the whole thing.
Now that you have the filepath for your media, you can use it in code.
This will get your image on the page:
Here, you can specify image dimensions (height and width), and the text that would appear if someone hovered their mouse over the image, or the image were to fail to load (alt). The Alt tag is important for accessibility, too. It’s what screen-read programs use to tell the visually impaired what’s pictured on your website.
<img src="http://www.domain.com/filepath" alt="Alternate Text" height="42" width="42" />