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

I'm working on a site that is using a theme with an attachment.php file in the theme. However, when going to an ima

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).

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

相关推荐

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

    I'm working on a site that is using a theme with an attachment.php file in the theme. However, when going to an ima

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信