Changeset 33281 for trunk/src/wp-includes/feed.php
- Timestamp:
- 07/15/2015 07:57:47 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/feed.php
r33224 r33281 86 86 $default_feed = apply_filters( 'default_feed', 'rss2' ); 87 87 return 'rss' == $default_feed ? 'rss2' : $default_feed; 88 }89 90 /**91 * Gets the timestamp of the most recently modified post from WP_Query.92 *93 * If viewing a comment feed, the date of the most recently modified94 * comment will be returned.95 *96 * @since 4.3.097 *98 * @return string Date ('Y-m-d H:i:s' for use with mysql2date()).99 */100 function get_last_build_date_feed() {101 global $wp_query, $wpdb;102 103 if ( $wp_query->have_posts() ) {104 $post_ids = array();105 $post_times = array();106 foreach( $wp_query->posts as $post ) {107 $post_ids[] = $post->ID;108 $post_times[] = $post->post_modified_gmt;109 }110 $postids = implode( "','", $post_ids );111 $max_post_time = max( $post_times );112 113 if ( $wp_query->is_comment_feed() ) {114 $max_comment_time = $wpdb->get_var( $wpdb->prepare( "SELECT MAX(comment_date_gmt) FROM $wpdb->comments WHERE comment_post_ID IN ('%s') AND comment_approved = '1'", $postids ) );115 116 return max( $max_post_time, $max_comment_time );117 }118 return $max_post_time;119 }120 121 // Fallback to last time any post was modified or published.122 return get_lastpostmodified( 'GMT' );123 88 } 124 89
Note: See TracChangeset
for help on using the changeset viewer.