In this post I’ll explain how to change (edit) slug of a WordPress media page.
1. Introduction – what is a media page slug?
When you add a picture (or a video) to a WordPress website, it gets its own URL (Uniform Resource Locator), which is a “technical” name for a web address. For example, the featured image of this post is located at the following URL address:
In other words, every picture you upload to your WordPress website will get an URL address in the following format:
However, for reasons known to its authors, whenever you add any media to your website (images, videos etc.), it also creates something called “media page”. Media page for the featured image of this post has the following URL address:
(My website won’t show this page, but it still reserves the URL, so I can’t make another page using the same URL)
The bold part of the link above is what WordPress calls “media page slug“. Media page URL address format is the following:
When I wanted to make a page with a list of all the BikeGremlin Cycles YouTube videos (sorted by categories/topics), I wanted to make the slug of that page be “youtube”, so that it would appear on the URL address:
But, WordPress kept automatically altering that page’s slug to “youtube-2”! Which meant that there already is “something” on the website that uses the “youtube” slug. To check, I went to that address, and saw a media page of the YouTube icon picture, that I had uploaded on the website years ago.
Post about WordPress permalinks, explains why and how WordPress prevents any two pages of sharing the same slug (hence, URL).
Since I am not an example of bright intelligence, it took me about 10 minutes to figure out how to edit the slug of the “youtube” media page, so that my new page could get that slug (and that URL). Writing it down here, in case I forget. 🙂
stay online & independent
This website is educational, free, objective, and not commercial
(sponsors don’t enjoy paying if you mention all the product downsides that you notice 🙂 ).
If you find this site to be good and helpful,
and if $5 per month is what you can afford to set aside,
please consider supporting my work with a Patreon donation:
2. How to edit/change WordPress media page slug (URL)?
It is simple, takes just three easy steps, and the pictures with short explanations show everything.
First, go to the media library, and choose the picture/video/other media who’s slug you wish to edit:
Next, in order to see and edit the “slug”, who’s display is disabled by default, follow the instructions shown in picture 2:
Finally, edit the slug to what you wish (as long as it’s available, not taken by any other page, as explained in chapter 1). The option for editing slug is usually near the bottom of the page (though this depends on which plugins you have installed), as shown in picture 3:
That’s it – simple, isn’t it? 🙂