Disable Media Pages

Remove "attachment" pages for WordPress media. Improve SEO and prevent conflicts between page and image permalinks.

Author:Johannes Siipola (profile at wordpress.org)
WordPress version required:5.0
WordPress version tested:5.9
Plugin version:1.2.1
Added to WordPress repository:31-12-2020
Last updated:28-01-2022
Rating, %:100
Rated by:5
Plugin URI:
Total downloads:2 675
Active installs:600+
plugin download
Click to start download

Completely disable “attachment” pages created by WordPress.

By default, WordPress creates a page for each of your attachments. This is can be undesirable because of two reasons:

Search engine optimization

Attachment pages don’t have any content, except an image, so they provide little value and can negatively affect your SEO.

Reserved slugs

Attachment pages can accidentally reserve slugs on your site. Let’s say you upload an image named contact.jpeg, an attachment page https://example.com/contact is automatically created. If you then try to create a page named Contact, the URL for that page will be https://example.com/contact-2 which isn’t that great.

How it works

This plugin works by automatically setting all attachment slugs to an unique id, so they won’t conflict with your pages. If an attachment page is accessed, the plugin will set a 404 status code and display the “page not found” template.

You can also mangle any existing attachment slugs so they won’t cause any issues in the future.

Thanks

Special thanks to Greg Schoppe for his research and inspiration that helped a lot with developing this plugin.

Support the plugin

Maintaining a WordPress plugin is a lot of work. If you like the plugin, please consider rating it on WordPress.org. You can also support me on GitHub sponsors. Thank you!

If you are interested, you can also check out my other WordPress plugins:


FAQ
ChangeLog