Skip to content

Commit

Permalink
Sort incoming posts better
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Feb 21, 2025
1 parent b25da21 commit 4f89081
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions includes/class-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,14 @@ public function process_incoming_feed_items( array $items, User_Feed $user_feed
$post_formats = get_post_format_strings();
$feed_post_format = $user_feed->get_post_format();

// Sort items by date asc so that older posts will have lower ids than newer posts.
usort(
$items,
function ( $a, $b ) {
return strtotime( $a->date ) - strtotime( $b->date );
}
);

// Limit this as a safety measure.
add_filter( 'wp_revisions_to_keep', array( $this, 'revisions_to_keep' ) );
$new_posts = array();
Expand Down

0 comments on commit 4f89081

Please sign in to comment.