0

I'm managing a WordPress site with a strange problem. When images are uploaded to the media library, a page is being generated with a permalink that uses the image's title attribute. For example, if the image's attribute is 'headshot' there will be a page with a URL of mysite.com/headshot. The page doesn't appear in the page list (or the post list, for that matter). There doesn't appear to be a plugin doing this, and I can't locate a setting to shut it off. I have never seen this happen before. Has anyone else?

1
  • Just FYI, these are normal and have always existed in WordPress. Commented Jan 8, 2020 at 0:32

1 Answer 1

0

Ah, you've discovered attachments :)

The media library isn't a file browser, and things that get put in the uploads folder don't just appear in the media library either. Did you never wonder how WordPress stored the titles and captions for images?

When you upload a photo, aside from the physical file, WordPress creates a post of type attachment. As we know, posts have titles, contents, post meta, etc. The post parent is the post that attachment is attached to, or uploaded to ( not reliably though as an image can appear in more than one post ).

A consequence of this is attachment pages, which have their own template. You can see when you add an image you have the option to link to its media page. You can use this as an opportunity to add comments, put more details on show, etc

As Jacob said, these are normal, and have always existed in WordPress, and they're intended. It's not something that appeared as a bug, it's not strange, and it's on every WordPress site in existence in some form.

You can get them in code by grabbing an attachments permalink or using the dedicated API function. You can also just click on the view attachment page link in an attachment view:

enter image description here

You can even edit the permalink from the attachments edit page:

enter image description here

On my site there's even a Yoast SEO box for optimising the attachment page for rankings

Keep in mind this isn't an option or setting, it's just how WordPress works and a natural consequence of how attachments work. The permalinks of attachments may vary from site to site, but they're always there

2
  • Funny, I've been working on WP sites for 15 years and I've never seen this. Not sure how I missed it! I even checked it out on other WP sites I manage when I noticed it happening, and it wasn't happening anywhere else, so clearly I've missed a setting.
    – joakland
    Commented Jan 9, 2020 at 1:06
  • It's not a setting you turn on or off, they're always there, even if the permalinks for attachments are different from site to site
    – Tom J Nowell
    Commented Jan 9, 2020 at 10:53

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