media - WordPress image title attribute becomes permalink?

This question already has answers here:Disable Attachment Pages Completely(4 answers)Closed 5 years ago.I'm managin

This question already has answers here: Disable Attachment Pages Completely (4 answers) Closed 5 years ago.

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/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?

This question already has answers here: Disable Attachment Pages Completely (4 answers) Closed 5 years ago.

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/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?

Share Improve this question asked Jan 8, 2020 at 0:09 joaklandjoakland 2511 silver badge7 bronze badges 1
  • Just FYI, these are normal and have always existed in WordPress. – Jacob Peattie Commented Jan 8, 2020 at 0:32
Add a comment  | 

1 Answer 1

Reset to default 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:

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744847745a4596945.html

相关推荐

  • media - WordPress image title attribute becomes permalink?

    This question already has answers here:Disable Attachment Pages Completely(4 answers)Closed 5 years ago.I'm managin

    2天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信