- Timestamp:
- 10/23/2023 03:40:44 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php
r54855 r56985 113 113 ); 114 114 115 /* 116 * Get the most recent posts displayed on the homepage, 117 * and then sort them by their modified date to find 118 * the date the homepage was approximately last updated. 119 */ 120 $latest_posts = new WP_Query( 121 array( 122 'post_type' => 'post', 123 'post_status' => 'publish', 124 'orderby' => 'date', 125 'order' => 'DESC', 126 'no_found_rows' => true, 127 'update_post_meta_cache' => false, 128 'update_post_term_cache' => false, 129 ) 130 ); 131 132 if ( ! empty( $latest_posts->posts ) ) { 133 $posts = wp_list_sort( $latest_posts->posts, 'post_modified_gmt', 'DESC' ); 134 $sitemap_entry['lastmod'] = wp_date( DATE_W3C, strtotime( $posts[0]->post_modified_gmt ) ); 135 } 136 115 137 /** 116 138 * Filters the sitemap entry for the home page when the 'show_on_front' option equals 'posts'. … … 126 148 foreach ( $query->posts as $post ) { 127 149 $sitemap_entry = array( 128 'loc' => get_permalink( $post ), 150 'loc' => get_permalink( $post ), 151 'lastmod' => wp_date( DATE_W3C, strtotime( $post->post_modified_gmt ) ), 129 152 ); 130 153
Note: See TracChangeset
for help on using the changeset viewer.