Disable Image Attachment in WordPress Pages Using Plugin/Manually

WordPress creates link/page for every media files. Sometimes it’s very bad for website owner. Because Search Engine like Google, Yahoo, Bing etc are index Media Attachment Page. It’s very disturbing for a visitor. In this post I’ll show you How To Disable Image Attachment in WordPress. Now I’m showing you 2 method for Disabling Image Attachment.

Method: 1

You need to install Yoast SEO Plugins. I think you can install WP Plugins. 🙂 After Install & activated go SEO => Advanced, here you will see a tab called Permalinks. Under, permalinks you will see “Redirect attachment URLs to parent post URL.” Just enable it. It’s very simple, isn’t it?

How To Disable Image Attachment

Method: 2

Now I’ll show you another method for Disabling Image Attachment.

<?php wp_redirect(get_permalink($post->post_parent)); ?>

Create a new file called image.php on theme folder. Copy above text to image.php if your theme has image.php file then you need to edit the file instead of create a new one.

I hope this blog post will help you to Disable Image Attachment in WordPress Pages Using Plugin/Manually. Feel free to ask any question by just leaving a comment. 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.