How to Disable WordPress Attachment Pages in 2024 (And Why)

Quick update on this topic as of : WordPress 6.4 has introduced a notable change in how attachment pages are handled. For all new WordPress installations, attachment pages are fully disabled by default. This only affects new installs – meaning users who installed their site recently and did so on WordPress 6.4 or newer from…
The post How to Disable WordPress Attachment Pages in 2024 (And Why) appeared first on Themeisle Blog.

Quick update on this topic as of 2024: WordPress 6.4 has introduced a notable change in how attachment pages are handled. For all new WordPress installations, attachment pages are fully disabled by default.

This only affects new installs – meaning users who installed their site recently and did so on WordPress 6.4 or newer from the start will have their attachment pages disabled.

However, if you’ve been running your site for quite a while and have just updated to WordPress 6.4 now, this won’t affect you. What this means is that for users like that, you still need to take action on your attachment page settings manually.

Below, I show you want you can do about that exactly:

How to test if you have attachment pages enabled

Go to your WordPress media library, click on any media file and look for this link:

If the link is there, you click on it, and you get taken to a standard WordPress page with just the attachment file embedded, then you obviously have attachment pages enabled.
If the link is not even there, or it says “view media file” instead, then you have attachment pages disabled already.

Here’s why you should disable the attachment pages entirely

Previously, WordPress automatically created an attachment page for each file uploaded. For example, let’s say you create a post and add three images to it. WordPress then automatically creates four URLs – three for the images, and one for the original post.

This feature, while well-intentioned, often led to unnecessary pages that cluttered your site and search engine results without adding value.

Disabling attachment pages streamlines content management and improves the overall quality of search results for users and site owners alike. A small but impactful adjustment to keep in mind as you work on your WordPress site!

Here’s how to disable attachment pages if you still have them

Previously, most people used plugins for this. SEO plugins in particular have a lot of features built-in to do various things with attachment pages, but you can pretty much ignore all that in 2024.

Instead, the fastest way to disable attachment pages and end up with a clean site structure is to go to the options.php page of your site and do a quick edit there.

Don’t worry, though, you don’t have to edit the file by hand.

Instead, go to your wp-admin and simply add “options.php” at the end of your URL. For example:

https://YOURSITE.COM/wp-admin/options.php

⚠️ Warning, this is technically an important file for WordPress’ overall operation. If you’re not 100% comfortable here, it’s advisable to make a backup of the site beforehand. Here’s some advice on backups.

Here’s what you’ll see (the beginning of that page):

Find the line that says wp_attachment_pages_enabled:

Simply change 1 to 0 there.
Click on save changes.

What this does:

As soon as you make this change, the attachment pages will be disabled, and all current attachment pages will be redirected to the raw URL of the attachment itself. (This is good, this is what you want).

That’s it! Done and done. 👌

Let me know if you have any further questions about this process.

Free guide

4 Essential Steps to Speed UpYour WordPress Website

Follow the simple steps in our 4-part mini seriesand reduce your loading times by 50-80%. 🚀

Free Access

Was this article helpful?
Yes

No

Thanks for your feedback!

You can check also:

Karol Krol is a writer, content strategist, and WordPress figure-outer with over 20 years of experience rooted in website building and web technologies. With his expertise underpinned by a master’s degree in computer science, he authored “WordPress Complete” – the ultimate WordPress handbook for newbies. His work has been published across numerous industry websites. He leads the editorial team at CodeinWP.

 


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *