From Yoast SEO v7.0, the option redirect media (attachment) pages to the parent attached page is no longer available. If you enable the media (attachment) redirects option now using the Yoast SEO plugin, it will redirect the media (attachment) pages to the actual media files instead of the parent attached pages.
That said if you’d like not to see all the images in the search results, you’ll first need to exclude them from the sitemap by using the following to your theme functions.php file:
/* Remove Images From Yoast Sitemap */
add_filter( 'wpseo_xml_sitemap_img', '__return_false' );
In addition, you’ll need to either set noindex or enable the media (attachment) redirects from the Yoast SEO -> Search Appearance -> Media (tab) options.
Once you do all this, Google will eventually drop the images from the search results. However, it will take a while and we are not sure how long it may take.
That’s great, thank you for your support. Just so that I am completely clear on the process, could you please confirm the steps below are correct:
1) Edit functions.php file to include your supplied code
2) SEO > Search appearance > media tab > Redirect attachment URLs to the attachment itself? > Yes
3) Upload new site map to search console
If we follow these steps, can you confirm that we do not need to then edit the advanced settings of each media file to change the Meta Robots Advanced to ‘no index’?
With the above steps, our images will no longer appear as search results in a normal google search or as snippets below our main site landing page.
One further question – will the images still be searchable in google images or with this be stopped as a result too?
Many thanks again for your advice!
-
This reply was modified 8 years, 4 months ago by
napoleon1.
The steps you have provided are correct. Once you implement all the steps correctly, you won’t need to go through your image attachment pages manually and set noindex.
Once you implement the provided code to disable the images in the XML sitemap, the images shouldn’t appear in any types of the Google search results. However, this will still take time for Google to remove all the images from the search results and we cannot confirm how long it would take.
Great thanks.
As you may have realised, I am not an experienced developer. Can I copy and paste your code to the end of my functions.php file without making any further amendments? I notice there were no brackets as with other lines of code in the file i.e. { }
Also, is there a way for the images to still appear in image search but not as their own page on normal google search?
Thanks again!
If you add the above-mentioned filter to your functions.php file, then the images should be excluded from the XML Sitemap Index. However, since we don’t want to take the risk that we break your website by suggesting incorrect or incomplete code, we cannot advise you on how to make such changes specifically. You may want to contact your developer or programmer for further assistance.
Please refer to this KB article for more information — https://kb.yoast.com/kb/images-in-the-xml-sitemap/#image-filter
I understand, thank you for your advice.
For my understanding, does removing the images from the XML sitemap negatively impact a websites SEO?
-
This reply was modified 8 years, 3 months ago by
napoleon1.
-
This reply was modified 8 years, 3 months ago by
napoleon1.
Yes, it may negatively impact a website SEO as good images can boost organic traffic from the search results.
Ok thanks. I presume it’s not possible for the images to still rank in image results but not for their URL attachment page to list in the normal google search?
Ok thanks. I presume it’s not possible for the images to still rank in image results but not for their URL attachment page to list in the normal google search?
Yes, the media (attachment) pages will appear in the search results if you don’t set them to noindex or enable the media (attachment) redirects.