
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:
Attachment pages don’t have any content, except an image, so they provide little value and can negatively affect your SEO because they are so-called thin content. Even worse, attachment pages may in some cases rank higher than your actual content pages which leads to a poor user experience.
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.
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.
The plugin supports WP CLI.
wp disable-media-pages mangle
wp disable-media-pages restore
WordPress 6.4 includes a new feature that allows you to disable attachment pages. However, this feature redirects attachment pages to the file URL instead of returning a 404 error. To completely disable attachment pages, you should use this plugin instead. The WP 6.4 feature also does not fix the issue where attachment pages reserve slugs for pages.
Also, there is not user interface to enable or disable media pages, they are automatically disabled for new sites but remain enabled for existing sites.
Because of these issues, I recommend you to use this plugin instead of the built-in feature. The plugin will be updated in the foreseeable future, at least until attachment pages are completely removed from WordPress core and older WordPress versions are no longer in use.
Special thanks to Greg Schoppe for his research and inspiration that helped a lot with developing this 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:
Starting from $0 per month.
Rating
Reviewers
13 reviews
Tags
Developed By
joppuyo
Quick & Easy
Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!
Testimonial plugins for Wordpress
Galleries plugins for Wordpress
SEO plugins for Wordpress
Contact Form plugins for Wordpress
Forms plugins for Wordpress
Social Feeds plugins for Wordpress
Social Sharing plugins for Wordpress
Events Calendar plugins for Wordpress
Sliders plugins for Wordpress
Analytics plugins for Wordpress
Reviews plugins for Wordpress
Comments plugins for Wordpress
Portfolio plugins for Wordpress
Maps plugins for Wordpress
Security plugins for Wordpress
Translation plugins for Wordpress
Ads plugins for Wordpress
Video Player plugins for Wordpress
Music Player plugins for Wordpress
Backup plugins for Wordpress
Privacy plugins for Wordpress
Optimize plugins for Wordpress
Chat plugins for Wordpress
Countdown plugins for Wordpress
Email Marketing plugins for Wordpress
Tabs plugins for Wordpress
Membership plugins for Wordpress
popup plugins for Wordpress
SiteMap plugins for Wordpress
Payment plugins for Wordpress
Coming Soon plugins for Wordpress
Ecommerce plugins for Wordpress
Customer Support plugins for Wordpress
Inventory plugins for Wordpress
Video Player plugins for Wordpress
Testimonials plugins for Wordpress
Tabs plugins for Wordpress
Social Sharing plugins for Wordpress
Social Feeds plugins for Wordpress
Slider plugins for Wordpress
Reviews plugins for Wordpress
Portfolio plugins for Wordpress
Membership plugins for Wordpress
Forms plugins for Wordpress
Events Calendar plugins for Wordpress
Contact plugins for Wordpress
Comments plugins for Wordpress
Analytics plugins for Wordpress
Common Ninja Apps
Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.
Create secure HIPAA compliant forms that protect sensitive data, offer full customization, and integrate easily for safe medical information collection.
Add social share buttons so visitors share content to major networks, boost engagement, and drive more referral traffic.
Show Etsy reviews to build trust, strengthen credibility, and help visitors make confident purchase decisions that support higher sales.
Create structured layouts with a section builder that lets you design custom website sections, customize styles, and organize content for a clearer user experience.
Use right click protection to prevent copying by disabling right click actions, protecting your content and reducing unauthorized reuse on your site.
Create interactive personality quizzes with custom results and flexible design to boost engagement and help visitors explore tailored outcomes easily.
Collect candidate information with a job application form that organizes submissions, streamlines hiring, and helps you manage applicants efficiently.
Verify visitor age with an age verification popup that helps you meet legal requirements, protect your business, and ensure responsible access.
Collect and manage donations securely with a customizable online donation form that supports Stripe or PayPal and helps increase contributions.
Nudge button with a subtle shaking animation that draws attention to important calls to action, increases interaction, and helps boost conversions.
Add a logo slider to your site to showcase clients and partners, strengthen brand credibility, and build trust with new visitors.
Show Sitejabber reviews to build trust, strengthen credibility, and help visitors make confident purchase decisions that support higher sales.
More plugins
The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!
