Plugin Updates

This commit is contained in:
Tony Volpe
2024-04-02 20:23:21 +00:00
parent 96800520e8
commit 94170ec2c4
1514 changed files with 133309 additions and 105985 deletions

View File

@@ -112,6 +112,29 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
'loc' => home_url( '/' ),
);
/*
* Get the most recent posts displayed on the homepage,
* and then sort them by their modified date to find
* the date the homepage was approximately last updated.
*/
$latest_posts = new WP_Query(
array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
)
);
if ( ! empty( $latest_posts->posts ) ) {
$posts = wp_list_sort( $latest_posts->posts, 'post_modified_gmt', 'DESC' );
$sitemap_entry['lastmod'] = wp_date( DATE_W3C, strtotime( $posts[0]->post_modified_gmt ) );
}
/**
* Filters the sitemap entry for the home page when the 'show_on_front' option equals 'posts'.
*
@@ -125,7 +148,8 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
foreach ( $query->posts as $post ) {
$sitemap_entry = array(
'loc' => get_permalink( $post ),
'loc' => get_permalink( $post ),
'lastmod' => wp_date( DATE_W3C, strtotime( $post->post_modified_gmt ) ),
);
/**