How to Change Image Permalinks in WordPress (and Reclaim Page URLs)

In this tutorial, we’ll discuss a common WordPress issue: reclaiming a page permalink (also known as URL or slug) that’s already occupied by an image. We’ll walk you through the process of changing the image’s permalink, so you can name your page URL as desired.

Join +3 980 subscribers!

Understanding Why WordPress Adds The Number”-2″ to your Page URL

All permalinks have to be unique. If you try to add a permalink that already exists, WordPress will automatically add a trailing number to the slug. But, as you probably already noticed, this can also happen if you don’t have a page with the same permalink.

The most likely reason is that images (and videos, pdf:s and other media items) in your WordPress Media Library also have their own permalinks. An image’s permalink is based on the image filename minus the file extension. If you, for example, upload the image products.jpg to your WordPress Media Library, the image URL will be domain.com/products/.

If you try to create a page with a permalink that is already occupied by an image (for example products), WordPress will automatically change the page URL domain.com/products-2 without any notification. That’s not good at all. Luckily, the solution is quick and easy – if you know where to look.

Alternative Method (If the Method Above Doesn’t Work)

If, for some reason, you cannot edit the image’s permalink as described above, you can try the following alternative method:

  1. Delete the image from your Media Library. Be cautious when doing this, as it will remove the image from your website entirely.
  2. Next, go to the page where you want to use the deleted image’s permalink.
  3. Edit the page and change its permalink with your desired slug.
  4. Save your changes and make sure that the page is published (and not just a draft).
  5. Finally, re-upload the deleted image. This time the tables has turned and WordPress will add the numerical suffix to the image permalink instead.

All pages and posts that contained the deleted image needs to be updated with the new image URL.

Pro tip: If you don’t want the trailing number to be added to your image’s permalink, just rename the image file name to something unique before uploading it.

That’s all for today!

WordPress provides flexibility when it comes to managing your website’s content and permalinks. By following the steps outlined in this tutorial, you can change an image’s permalink to reclaim a specific page URL. Whether you choose to edit the image’s permalink directly or use the alternative method, you’ll have the freedom to structure your site’s URLs as you see fit. This can help improve your workflow and user experience.

I hope that you enjoyed this post. Subscribe to DiviMundo on YouTube and join our Facebook group for more crisp content on WordPress and web design.

👉 Related post: How To Disable Automatic Image Titles In WordPress

👉 Free course: Create a website from scratch with Divi

Related posts

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Affiliate Disclaimer

All content on DiviMundo is funded by you – our beloved readers. Some of the links are affiliate links. This means that if you click on the link and purchase something, I will receive an affiliate commission. But it will never cost more for you. Thanks for your support!

Victor Duse, founder of DiviMundo