Premium Member? To redirect attachment pages to the parent post URL, there are at least 5 different solutions to choose from:. Simply copy this PHP code from the view raw link in the Gist and paste it at the end of your child themes functions. If you have found another way to redirect attachment pages to the parent post, please add the solution in the comments. Thanks for the nice code snippet Brad. Unfortunately, Yoast SEO now redirects Attachment URLs to direct media file instead to the attached page or post, so used the first method and it works great! Most of my attachment pages are indexed in Google.
Sometimes you need to redirect a parent page to its child page, especially if you need to keep a specific type of menu hierarchy. There are several ways to do this, but I prefer using Advanced Custom Fields. This is because it allows content editors control over the redirect, and also allows for greater flexibility in the future. First create a new page template. The name doesn't matter, but I like to call mine Redirector so as to be expressive.
Yoast offers a handy feature which allows you to redirect any attachment page to the parent post or page. You need to have the Yoast SEO plugin installed for this solution. If attachment pages have parent pages, they will now be redirected to them. An unattached media attachment will have no parent or post page it could redirect to. There are measures you can explore to address this , but this goes beyond the scope of what we can do using Yoast. However, Yoast does enable you to specify a noindex rule for unattached media pages:. For every image that is uploaded, using the media library of WordPress, an attachment page is created. You can consider this a page like any other page, post or custom post-type you typically create in WordPress, which means you would be able to view this attachment on a front-end through a page; the attachment page. Since these are stand-alone pages, they could be indexed by search bots if they are included in the sitemap or linked to internally, or externally, from a post.
Need help? Check out our Support site , then. I know that when I make a menu I can add a button that directs people to a completely different site. But how can I do that with a drop down menu? Then you will have to include that static page in your custom menu. Drop-downs are the result of creating hierarchical structure. They are either sub-pages child pages of a parent page or sub-categories. When you create a static page look in the Page attributes box in the far right hand column and there you will be able to assign hierarchical order. Create a static page for Social Networks Parent page and then create sub-pages child pages for twitter.