Last active
April 2, 2022 17:38
-
-
Save amboutwe/ebc7a8b974c2735cdd5aae84035bf65b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Prevent Yoast SEO for adding specific post types to indexables | |
* Credit: Yoast team | |
* Last Tested: Jan 18 2021 using Yoast SEO 15.6.2 on WordPress 5.6 | |
* Documented: https://github.com/Yoast/wordpress-seo/blob/trunk/src/helpers/post-type-helper.php#L90 | |
* Common post types: 'post', 'page', 'attachment', 'product' | |
*/ | |
add_filter('wpseo_indexable_excluded_post_types', 'yoast_exclude_some_custom_post_types'); | |
function yoast_exclude_some_custom_post_types ( $excluded_post_types ) { | |
$excluded_post_types[] = 'post_type_slug'; // Repeat for each type to exclude | |
return $excluded_post_types; // Do not remove this line | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment