Changeset 44948 for trunk/src/wp-includes/feed.php
- Timestamp:
- 03/20/2019 08:37:02 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/feed.php
r42414 r44948 638 638 } 639 639 640 /* 641 * Get the timestamp of the most recently modified post from WP_Query. 642 * 643 * If viewing a comment feed, the date of the most recently modified 644 * comment will be returned. 645 * 646 * @global WP_Query $wp_query The global WP_Query object. 647 * 648 * @since 5.2.0 649 * 650 * @return string The timestamp. 651 */ 652 function get_last_build_date() { 653 global $wp_query; 654 655 if ( empty( $wp_query ) || ! $wp_query->have_posts() ) { 656 // Fallback to last time any post was modified or published. 657 return get_lastpostmodified( 'GMT' ); 658 } 659 660 // Extract the post modified times from the posts. 661 $modified_times = wp_list_pluck( $wp_query->posts, 'post_modified_gmt' ); 662 663 // If this is a comment feed, check those objects too. 664 if ( $wp_query->is_comment_feed() && $wp_query->comment_count ) { 665 // Extract the comment modified times from the comments. 666 $comment_times = wp_list_pluck( $wp_query->comments, 'comment_date_gmt' ); 667 668 // Add the comment times to the post times for comparison. 669 $modified_times = array_merge( $modified_times, $comment_times ); 670 } 671 672 // Determine the maximum modified time. 673 $max_modified_time = max( $modified_times ); 674 675 /** 676 * Filters the date the last post or comment in the query was modified. 677 * 678 * @since 5.2.0 679 * 680 * @param string $max_modified_times Date the last post or comment was modified in the query. 681 */ 682 return apply_filters( 'get_last_build_date', $max_modified_time ); 683 } 684 640 685 /** 641 686 * Return the content type for specified feed type.
Note: See TracChangeset
for help on using the changeset viewer.