最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

templates - Attachment URL for an image is loading direct image file

programmeradmin2浏览0评论

I'm working on a site that is using a theme with an attachment.php file in the theme. However, when going to an image's attachment page (i.e. https://domain/john-doe/) it loads the direct image (i.e. https://domain/files/2020/03/john-doe.png).

What would cause this to occur? I thought WordPress would load the attachment URL and present the item as coded in attachment.php, not the media file itself.

I'm working on a site that is using a theme with an attachment.php file in the theme. However, when going to an image's attachment page (i.e. https://domain/john-doe/) it loads the direct image (i.e. https://domain/files/2020/03/john-doe.png).

What would cause this to occur? I thought WordPress would load the attachment URL and present the item as coded in attachment.php, not the media file itself.

Share Improve this question asked Mar 24, 2020 at 17:57 AnthonyAnthony 311 silver badge5 bronze badges 1
  • 1 It depends on your theme and plugins. If you're using a plugin like Yoast WP SEO, there are settings to disable attachment pages (because they're usually not good for SEO). Check your plugin settings and/or deactivate all plugins, see if you still have the problem, and reactivate one by one to find out which one is the issue. – WebElaine Commented Mar 24, 2020 at 20:20
Add a comment  | 

1 Answer 1

Reset to default 0

Thanks @WebElaine.

We're running Yoast SEO so I had another look and saw the setting in Search Appearance > Media (wp-admin/admin.php?page=wpseo_titles#top#media).

发布评论

评论列表(0)

  1. 暂无评论