Attachment pages stealing page slugs

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1844
    morceaudebois
    Participant

    Hi,

    I’m working on remaking a big website with its upload folder already full of many gigabits of images. I just noticed a problem I never noticed with WordPress before: it seems to create attachment pages based on the name of the images, which means that it “steals” most of the page slugs I want to use.

    For example, let’s say I have an image named about.jpg in my upload folder. The URL [mysite.com/about](https://mysite.com/about) will be created and automatically redirect to that image. Now, if I want to create a regular page named *About*, the URL doesn’t have the priority on the attachment and will be forced be called [mysite.com/about-2](https://mysite.com/about-2).

    It’s quite frustrating to not have clean URLs, and I haven’t found much on the web about it, which is strange. It tried the filter mentioned [here](https://wordpress.stackexchange.com/questions/179162/stop-wordpress-from-reserving-slugs-for-media-items) but it doesn’t seem to do anything. Any help would be appreciated. Thank you 🙂

    #1845
    morceaudebois
    Guest

    Well, I probably won’t have an answer but I’ve found a workaround. Here goes if someone has the same problem:

    In the database, you can search for the attachment page that’s causing problem, you’ll find it in wp_posts by searching for its post_name (which is the slug you want). Then just rename that post_name (*about-img* for example). It isn’t a fix but it will make the desired slug available for your page’s URL.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.