Home Plugins&ToolsImage How to Modify Image Permalinks in WordPress?

How to Modify Image Permalinks in WordPress?

by The Editorial Team

In this guide, we will address a prevalent WordPress concern: reclaiming a page permalink (also referred to as URL or slug) that is currently associated with an image. We will guide you through the steps of altering the image’s permalink, allowing you to assign your desired name to the page URL.


RECOMMENED BY OUR EDITORS


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

All permalinks must be unique. If you attempt to assign a permalink that already exists, WordPress will automatically append a trailing number to the slug. However, this can occur even when there is no existing page with the same permalink.

This is often caused by images (as well as videos, PDFs, and other media items) in your WordPress Media Library, which also have their own permalinks. An image’s permalink is derived from the image filename without the file extension. For instance, if you upload an image named “products.jpg” to your WordPress Media Library, the image URL will be domain.com/products/.

If you attempt to create a page with a permalink that is already in use by an image (such as “products”), WordPress will automatically modify the page URL to domain.com/products-2 without any notification. Fortunately, the solution is swift and straightforward—provided you know where to find it.

Changing Image Permalinks in WordPress Media Library

Access the Media Library

To get started, you need to access your WordPress Media Library:

  1. Log in to your WordPress dashboard.
  2. In the left-hand menu, hover over “Media” and click on “Library.” This will take you to your Media Library, where you can manage your images.

Edit the Image Details

Now, locate the image for which you want to change the permalink:

  1. Scroll through your Media Library and find the image in question. Click on it to select it.
  2. Once the image is selected, you should see an “Edit more details” link. Click on this link to access the editing options for the image.

Edit the Image Permalink

To change the image’s permalink, follow these steps:

  1. In the editing screen, you might not see an option to edit the permalink by default. In this case, click on the “Screen Options” button at the top-right corner of the page.
  2. A dropdown menu will appear. Check the “Slug” checkbox to enable the permalink editing option.
  3. Scroll down, and you should now see the “Slug” field. This is where you can edit the image permalink.
  4. Modify the Slug to your desired permalink to make the original permalink available for your page. For example, if you want to change it to “network-connection” simply type “network-connection” into the field.
  5. Once you’ve made the necessary changes, click the “Update” button to save your new permalink.

Verify the Changes

After updating the image’s permalink, you should see a confirmation message indicating that the changes have been saved. To ensure everything is working as expected, follow these final steps:

  1. Navigate to the page where you want to use the permalink that was occupied by the image (in this example: “network-connection”).
  2. Edit the page and change the permalink by clicking the “Edit” button to the right of the page URL below the Page Title.

Congratulations! The permalink should now be available for your page without any conflicts. Clear your browser cache and website cache to make sure that the update takes effect.

related posts

Leave a Comment