Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wp-seopress/6699f2d9ad6d65903870b1f80c28cfa0 to your computer and use it in GitHub Desktop.
Save wp-seopress/6699f2d9ad6d65903870b1f80c28cfa0 to your computer and use it in GitHub Desktop.
Filter the video XML sitemap regeneration tool
function sp_video_regeneration_total_count_posts($sql) {
global $wpdb;
$sql = (int) $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts} WHERE post_status IN ('pending', 'draft', 'publish', 'future') AND post_type IN ( 'your_cpt_name' ) ");
return $sql;
}
add_filter('seopress_video_regeneration_total_count_posts', 'sp_video_regeneration_total_count_posts');
function sp_video_regeneration_increment($increment) {
//default: 1
$increment = 10;
return $increment;
}
add_filter('seopress_video_regeneration_increment', 'sp_video_regeneration_increment');
function sp_video_regeneration_query($args, $increment, $cpt, $offset) {
//default
$args = [
'posts_per_page' => $increment,
'post_type' => $cpt,
'post_status' => ['pending', 'draft', 'publish', 'future'],
'offset' => $offset,
];
return $args;
}
add_filter('seopress_video_regeneration_query', 'sp_video_regeneration_query', 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment