0

I have a WordPress installation setup but I'm having trouble with items uploaded to the media library taking up pretty permalinks. The only way to fix it that I've figured out so far is to delete the image from the library. However the image in question is used all over the site so I would much rather find another solution.

Example:

Say I upload an image called foo.jpg then make a page called foo, the pretty permalink for the page becomes /foo-3. If you try and change it, it reverts back to 3, unless you use something that isn't 'taken'. If I navigate to url.com/foo I get the attachment page for the image and not the page.

I've tried changing the permalink settings to all the different settings. I've also tried renaming the image 'title' but that is no good either.

Is there anything else I can do to force the permalink?

Thanks

1
  • I can't get you what you want to do? Commented Feb 16, 2016 at 16:22

1 Answer 1

3

It's not your permalink settings, it's the fact that foo.jpg was uploaded first and "stole" the slug foo - you need to change it to something else, then set your page slug.

Go to Media > foo.jpg > Edit (if you are in grid view, you need to go to "Edit more details")

enter image description here

From this page you can edit the permalink/slug (just like pages/posts, right beneath the title field) and set it something that isn't foo.

Now go re-save your page with slug foo.

3
  • Thanks, I completely forgot about this edit screen! However, next issue there seems to be no edit button for the permalink. On another WordPress installation I can see it, but on my local dev and a remote dev site I can't see it. Any ideas?
    – matbush
    Commented Feb 16, 2016 at 16:57
  • Nevermind, I was able to get around it be turning on the slug checkbox in the Screen options section and then edit it there. Thanks though!
    – matbush
    Commented Feb 16, 2016 at 17:05
  • For me I couldn't change the slug on the permalink either - the problem was that the name of the media item (at the very top) was blocking my permalink. Changing that fixed it.
    – Chris Rae
    Commented Oct 4, 2022 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.