Start » WordPress » In general » How to change WordPress media page slug (URL)

How to change WordPress media page slug (URL)

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. 🙂

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:

Choosing an image for editing its media page URL
Choosing an image for editing its media page URL
Log into your WordPress dashboard, click on “Media” (1)
then click on “Library” (2)
Find the image who’s media page URL you wish to edit, hover the mouse over it and click “Edit” (3)
Picture 1

Next, in order to see and edit the “slug”, who’s display is disabled by default, follow the instructions shown in picture 2:

Displaying URL of a media page
Displaying URL of a media page
In the top right hand corner of the screen, click on “Screen Options” (1)
Then make sure to check the option for displaying “Slug” (2)
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:

Editing media page URL (slug)
Editing media page URL (slug)
Find the “Slug” section and enter the new slug you want (1)
Click on the “Update” (2)
Note: media page slug/URL (1) is different from image/video file URL (3)
Picture 3

That’s it – simple, isn’t it? 🙂


Leave a Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.