Skip to content

Commit

Permalink
Sort post types for consistent cache key generation
Browse files Browse the repository at this point in the history
An update was made to the WP_Query class to ensure that when multiple post types are in use, they are sorted to generate a consistent cache key. This helps avoid potential issues with cache key mismatch and optimizes the performance of WordPress' cache system.
  • Loading branch information
spacedmonkey committed Apr 30, 2024
1 parent 900df75 commit 55026bc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/wp-includes/class-wp-query.php
Expand Up @@ -2264,6 +2264,9 @@ public function get_posts() {
$post_type = 'any';
} elseif ( count( $post_type ) === 1 ) {
$post_type = $post_type[0];
} else {
// Sort post types to ensure same cache key generation.
sort( $post_type );
}

$post_status_join = true;
Expand Down

0 comments on commit 55026bc

Please sign in to comment.