The upcoming 6.4 release, expected on November 7, will disable attachment pages for new installations. Up until now, WordPress automatically created attachment pages when users upload a file through the media upload system. It has been treated as a special post type that holds information about the file and each attachment is accessible under its own URL. SEO plugins have been redirecting attachment pages for years, as they rarely have any significant purpose.
“Until WordPress 6.4 was released, WordPress created attachment pages by default for every attachment uploaded,” WordPress contributor Joost de Valk said in the dev note for this change. “On the vast majority of sites, these attachment pages don’t add any meaningful information. They do, however, exist, get indexed by search engines, and sometimes even rank in search results, leading to bad results for users and site owners.”
There will be no changes to existing sites. They will continue to work as they always have, but new sites will have their attachment pages redirected to the attachment URL. Site admins who want to enable or disable attachment pages can use the new
wp_attachment_pages_enabled database option to control attachment pages’ behavior.
There is no interface for changing whether a site disables attachment pages, which was somewhat controversial in the comments on the Trac ticket and the dev note.
“In light of the WordPress mantra ‘decisions, not options,’ we’ve decided against making a setting for this,” de Valk said.
WordPress plugin developer Sybre Waaijer mades a case for giving users an option with an interface for toggling it on or off:
The problem with filtering options is that when another plugin provides the option toggle, the option filter will go against user expectations.
This is where “decisions, not options” becomes paradoxical because we’re now deciding to set an option while also not giving the option.
So, as plugins fill in this gap, then A) where will plugins put the option (likely on their custom page instead of options-media.php), and B) of the dozens of types of plugins that are in the market to juggle this, who will ultimately be in control of the option?
If it’s a filter, each plugin promises to set a toggle via a simple condition. But since it’s an option, plugins can add an option to filter an option and add an option to toggle the option. It’ll become a source of bugs because of the logical biconditionals (XNOR).
While an interface isn’t in the cards for WordPress 6.4, and may never be back on the table for consideration, contributors are discussing the possibility of putting this in a core plugin.
“Should we not have a core plugin for re-enabling attachment pages on new sites?” Automattic-sponsored contributor Justin Tadlock said. “If there’s not going to be a UI for this, then a plugin that’s not buried in a Trac ticket would be ideal.”
de Valk agreed this would be a good idea to have a plugin that simply adds a setting to the Options -> Media page. Users likely will not understand the purpose of attachment pages unless they are looking to enable them for a specific, niche use case. A plugin like this would be useful for those who are not able to write the code to change attachment pages’ behavior, as described in the dev note.