Understanding images handeling

They aren’t the same, one is the URL of the file in the uploads folder, the other is the permalink of the attachment post that represents that file. All uploaded files have attachment posts, that’s what you’re seeing listed in the media library. WordPress itself doesn’t know about the files and can even show things that aren’t in the uploads folder if you manually delete them.

Since most people are unaware of them and are confused when they first encounter them and think it’s a bug, attachment templates/pages are disabled by default on new installs as of WP 6.4, and can be disabled for old sites:

https://make.wordpress.org/core/2023/10/16/changes-to-attachment-pages/

TLDR: Set the wp_attachment_pages_enabled option to the value 0 to disable attachment pages.

One of the downsides is that most theme authors are unaware and ignore the audio.php/attachment.php/etc templates, or if they do handle them they display the file directly without any special handling, which implies duplication which spooks people concerned with SEO who see this for the first time and don’t know about this.

Yes that’s it, attachment pages. What is the reason for them? Is there any way to prevent them?

You could just display the attachment, but these pages give you opportunities to do other things such as:

  • password protections
  • displaying author/EXIF/location data
  • Comments!
  • sharing the attachment directly
  • custom templating
  • custom players such as video/PDF/audio

In the past I’ve used them so that when people click on gallery thumbnails in my posts they stay on my site and can click back and forwards, read more in depth captions, leave comments, etc. I also stripped down the template to show my header and highlight images.

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino