-
AuthorPosts
-
April 27, 2018 at 4:54 pm #948035
Hi guys!!
I imagine you noticed Yoast has made a lot of changes to their plugin. Well, some have created issues and I am trying to stop Yoast from creating two of their sitemaps: the Attachment (I am not redirecting them it’s not always the best solution but no need for sitemap) and the Category as it needs to be indexed but it has a redirect in my case so sitemap is out.
Here’s the code they provided to me to add to the functions.php file, is this code good to use with Enfold or will I mess something up?
/* Exclude Post Type From Yoast SEO Sitemap */
function filter_wpseo_sitemap_exclude_post_type( $value, $post_type ) {
if ($post_type == ‘attachment’) return true;
};
add_filter( ‘wpseo_sitemap_exclude_post_type’, ‘filter_wpseo_sitemap_exclude_post_type’, 10, 2 );/* Exclude Taxonomy From Yoast SEO Sitemap */
function filter_wpseo_sitemap_exclude_taxonomy( $value, $taxonomy ) {
if ( $taxonomy == ‘category’ ) return true;
}
add_filter( ‘wpseo_sitemap_exclude_taxonomy’, ‘filter_wpseo_sitemap_exclude_taxonomy’, 10, 2 );Thank you soooo much!!
Warmly,
Havi
April 30, 2018 at 11:16 am #948981Hey havi,
The code should not affect Enfold’s code.
If you need further assistance please let us know.
Best regards,
VictoriaMay 14, 2018 at 11:10 pm #956740Hi Victoria!
I tried their code and it does not stop those Sitemaps from being created. I know this is not your plugin but I wanted to share just in case somebody thought this would work.
But if you know of some code that will actually work, please do share!!
Thank you!!!
Havi :)
May 16, 2018 at 8:33 pm #957671Hi,
If you open a ticket and speak with the Yoast team, please feel free to update the code here.
Best regards,
BasilisMay 16, 2018 at 9:42 pm #957735Hi Basilis and Victoria!
I did place a ticket and got the answer. It seems like the only way to eliminate one of their Sitemaps is to have a noindex directive on the page. Still, this does not work for the attachment pages and I raised that bug to them. The only way to avoid having these attachment pages from being indexed without redirecting them to the image itself (the media itself) under Search Appearance > Media > Redirect attachment URLs to the attachment itself? is to leave this Option as No and set Show Media in search results? (the next option) to No as well.
You can still re-direct the attachment pages to the posts by using the Attachment Pages Redirect plugin (I did it and it works like a charm) just install and activate and there’s nothing else to do.
Two words of warning: If you have an attachment that is the downloadable for a WooCommerce product, you’ll be better off creating a new folder under WP Content > Uploads and pointing to that URL
Next, if you are activating the Attachment Pages Redirect plugin on a Multisite, enable it on each site separately. It works.Hope this helps!!
Warmly,
Havi
May 18, 2018 at 4:35 pm #958670Hi Havi,
Thank you for taking the time to share this with us and the users :)
If you need further assistance please let us know.
Best regards,
VictoriaMay 18, 2018 at 5:19 pm #958701Thanks to you and the whole team, Victoria!! You are always there for all of us so this is the least I can do!
Warm regards,
Havi
May 18, 2018 at 6:02 pm #958749Hi,
We truly appreciate this. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Yoast and Sitemaps’ is closed to new replies.