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
function max_entries_per_sitemap() { | |
return 1000; | |
} | |
add_filter( 'wpseo_sitemap_entries_per_page', 'max_entries_per_sitemap' ); |
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
/* Exclude One Content Type From Yoast SEO Sitemap */ | |
function sitemap_exclude_post_type( $value, $post_type ) { | |
if ( $post_type == 'post_type_slug' ) return true; | |
} | |
add_filter( 'wpseo_sitemap_exclude_post_type', 'sitemap_exclude_post_type', 10, 2 ); |
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
/* Noindex all posts in a category */ | |
add_filter("wpseo_robots", function($robots) { | |
if (is_single() && in_category(array(100))) { | |
return "noindex,follow"; | |
} | |
return $robots; | |
}); |
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
add_filter( 'wpseo_opengraph_image', 'change_opengraph_image_url' ); | |
function change_opengraph_image_url($url) { | |
if ( is_shop() ) { | |
return 'https://your-image-url.jpg'; | |
} else { | |
return $url; | |
} | |
} |
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
// define the custom replacement callback, returns the date in Jan 2019 format | |
function get_my_date() { | |
return date('M Y'); | |
} | |
// define the action for register yoast_variable replacments | |
function register_custom_yoast_variables() { | |
wpseo_register_var_replacement( '%%my_date%%', 'get_my_date', 'advanced', 'returns the current date' ); | |
} |
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
function disable_schema_on_post_type( $post_type ) { | |
if ( $post_type == 'post' ) return false; | |
} | |
add_filter( 'wpseo_json_ld_output', 'disable_schema_on_post_type', 10, 2 ); |
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
function delete_all_terms(){ | |
$taxonomy_name = 'yst_prominent_words'; | |
$terms = get_terms( array( | |
'taxonomy' => $taxonomy_name, | |
'hide_empty' => false | |
) ); | |
foreach ( $terms as $term ) { | |
wp_delete_term($term->term_id, $taxonomy_name); | |
} | |
} |