wordpress agency, wordpress agency for development, enterprise wordpress, wordpress website, wordpress developer, make a website, wordpress sites, wordpress blog, wordpress for dummies, wordpress website development, wordpress website design, wordpress design, wordpress web design, wordpress help, wordpress designer, premium wordpress themes, create a wordpress website, wordpress plugin development, wordpress theme development, build a wordpress website, wordpress website templates, wordpress web, woocommerce plugin, wordpress free website, wp themes, setting up a website, wordpress web development, wordpress homepage, wordpress cms, best wordpress sites, custom wordpress theme, wordpress for beginners, best wordpress websites, using wordpress, wordpress designs, create website using wordpress, wordpress web developer, wordpress website hosting, wordpress website examples, create new website, start a website, wordpress premium, wordpress web hosting, create wordpress, wordpress customization, wordpress plugin developer, create wordpress theme, custom wordpress development, wordpress guide, wordpress programming, wordpress design services, create wordpress blog, wordpress website tutorial, using wordpress to build a website, how to build a wordpress website, wordpress website developer, using wordpress to create a website, custom wordpress design, wordpress website designers, building a website from scratch, online site hosted by wordpress, wordpress website development company, hosted wordpress, i want to create a website, best wordpress, build website using wordpress, woocommerce wordpress, website using wordpress, make a wordpress website, setting up a wordpress site, start a wordpress blog, wordpress web design company, wordpress website development services, buy wordpress themes, custom wordpress, create wordpress site, wordpress web design services, wordpress themes for business, wordpress page, world press website, custom wordpress website, steps to create a website, websites created with wordpress, best way to create a website, wordpress web design for dummies, wordpress website design company, learn wordpress step by step, build wordpress site, building a website for dummies, using wordpress for a website, create a website from scratch, wordpress website themes, website design using wordpress, wordpress business website, best way to build a website, design wordpress theme, wordpress site design, wordpress professional, wordpress blog page, wordpress site development, how to create a website with wordpress, top wordpress sites, make a website from scratch, make a webpage, build your own wordpress website, setting up a wordpress blog, get wordpress, wordpress layouts, building a website, wordpress website design tutorial, wordpress free site, website creation, e commerce website, website design, create wordpress account, wordpress web development services, design a website, wordpress cms tutorial, setting up your own website, create your own website wordpress, website developer, website developers, best premium wordpress themes, wordpress free blog, top wordpress websites, create a blog website, build wordpress theme, webdesign, website design companies, best way to make a website, web agency, web developers, custom wordpress plugin development, web page design, wordpress malware, web design companies, ecommerce website design, designer websites, professional website design, wordpress best themes, wordpress create website free, professional website, custom wordpress website design, wordpress blog examples, wp plugin development, examples of wordpress sites, web development companies, web design agency, wordpress webpage, custom website design, mobile website design, best way to learn wordpress, web development agency, popular wordpress blogs, setting up a wordpress website, ecommerce web design, create your own wordpress theme, custom web design, ecommerce website development, wordpress web design theme, build your own wordpress site, website companies, website design agency, website development company, wordpress for business, web application development, best wordpress designers, custom website, web design tools, professional web design, web creation, design companies, web design studio, web development websites, new wordpress, ecommerce design, how to use wordpress to create a website, website design and development, wordpress website management, wordpress start, make a wordpress site, wordpress membership plugin, new wordpress website, web design and development, make wordpress, custom wordpress site, the best wordpress themes, ecommerce web development, wordpress application development, great wordpress sites, wordpress theme designer, new website design, wordpress step by step, web design portfolio, develop website using wordpress, create professional website, best web design, online wordpress, new wordpress site, wordpress tutorials for beginners, best web design company, create wordpress template, start wordpress website, themes wordpress, world press website design, build your website with wordpress, best wordpress blogs, learn to build a website, wordpress tutorial 2022, woocommerce shop, web design prices, premium wp themes, ecommerce website development company

WordPress Agency for Development | Vipe Studio » WordPress Development » A Guide to Disabling Media Attachment Pages on WordPress

A Guide to Disabling Media Attachment Pages on WordPress

Reading Time: 3 minutes

As any WordPress agency for development worth their late-night coffee will tell you, media attachment pages do not leave a good impression on visitors to your website, as they can look unprofessional and incomplete.

Today we’ll look at two ways to disable these pages, instead of redirecting to the original post on WordPress.

Why Do We Even Need to Disable Attachment Pages

For all sorts of media, including images or even documents, WordPress creates a page on your site – a media attachment page. While there are certain use cases where this feature might be useful, most websites don’t need a separate page for every single attachment that has been uploaded.

Most themes for WordPress don’t even have a template for these pages, and they end up looking inconsistent with the rest of the website. Getting the help of a WordPress agency for development could help with clearing up such inconsistencies, but even then, an attachment page isn’t really necessary for most kinds of websites.

Another reason to disable these pages is that an image on your website might get a lot of hits from search engines, but instead of landing on the content where the image is displayed, visitors from Google (or any search engine) might end up on its media attachment page.

Disabling Attachment Pages

We’ll discuss two methods to do this. The first approach involves plugins, while the second has to do with custom code that you can add-in. Read through and pick whichever method you’re comfortable with.

  Viptor Says: The New Hypernotes WordPress Plugin

Using a Plugin (or Two)

This is the simpler method, great for beginners, and involves no code at all. All in One SEO is a popular plugin that you can use to disable attachment pages as well. Install and activate the plugin, and this will generate a new item in the menu called ‘All in One SEO’. Click on it and select ‘Search Appearance’, then go to the ‘Media’ tab. First, you’ll see ‘Redirect Attachment URLs’. Here, you can choose to disable the page, or redirect, either to the attachment page itself or to the parent content URL. We’d advise picking the ‘Attachment Parent’ option. Once you’re done selecting, ‘Save Changes’.

Another plugin that will do the same thing for you is called ‘Attachment Pages Redirect’. Once activated, it will begin redirecting users to the parent page of any attachment. If there is no parent page for the attachment in question, it will send users back to your homepage. There are no settings to change and it just works!

Using Custom Code

A code snippet can also be used to achieve the same result as the two plugins we have discussed above. If you’re not comfortable with plugins or you have too many plugins already installed on your website, this might be the method for you.

  How to Do SEO Competitor Analysis for Your WordPress

To start, a new file named image.php needs to be created and saved in your WordPress theme folder. If there is already a file in the folder by that name, you can just edit that file. Regardless, on the first line of that file, insert this custom code:  wp_redirect(get_permalink($post-post_parent));

Save the file and upload it to your theme directory via FTP or using the control panel of your WordPress hosting provider. This little snippet of code ensures that the next time a visitor stumbles into one of your attachment pages, they will be promptly redirected to the parent content of the media.

With that, we wrap up this article on how to disable media attachment pages on your WordPress website, and we hope you’ve found it useful. We’ll meet you next time with more tips and tutorials on WordPress, and until then, keep dodging those attachment pages!

Looking for WordPress Website Development for your Business?

Our professional developers have proven experience in building high-quality business websites that outperform the competition, thanks to our meticulous attention to detail and the implementation of cutting-edge technologies. We will conduct an in-depth business analysis to ensure the website we create for you meets your highest expectations. Your site will have all of the necessary elements to assist you in increasing your ROI and sales.

Contact Us

The content of this website is copyrighted and protected by Creative Commons 4.0.

Tags:

Vipe Team

Author Vipe Team

Our tireless team who creates high-quality WordPress-related content for you 24/7/365.

Comments

Leave a Reply

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

We have already created hundreds of profiting websites!

We have already created hundreds of profiting websites!

Subscribe to our newsletter and get our best WordPress tips!

[mc4wp_form id="8747"]