Skip to content
Closed
1 change: 0 additions & 1 deletion src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@
add_action( 'attachment_updated', 'wp_check_for_changed_dates', 12, 3 );

// Random content redirects, see WP::handle_random().
add_filter( 'split_the_query', 'wp_random_content_split_the_query', 10, 2 );
add_action( 'wp_after_insert_post', 'wp_random_content_flush_rewrite_rules_for_post', 10, 4 );
add_action( 'after_delete_post', 'wp_random_content_flush_rewrite_rules_for_post', 10, 2 );

Expand Down
21 changes: 0 additions & 21 deletions src/wp-includes/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -1461,27 +1461,6 @@ function wp_random_content_post_limits( $limits, WP_Query $query ): string {
return (string) $limits;
}

/**
* Prevents the random content query from being split into multiple database queries.
*
* Randomly ordered queries are not cached, so there is no benefit to querying the post
* IDs separately to the post objects. Disabling the split allows the random post to be
* retrieved in a single database query.
*
* @since 7.2.0
*
* @param bool $split_the_query Whether or not to split the query.
* @param WP_Query $query The WP_Query instance.
* @return bool Whether or not to split the query.
*/
function wp_random_content_split_the_query( $split_the_query, WP_Query $query ): bool {
if ( wp_is_random_content_query( $query ) ) {
return false;
}

return (bool) $split_the_query;
}

/**
* Redirects random content requests to the randomly selected post.
*
Expand Down
Loading
Loading