Skip to content

Commit

Permalink
Fixes #6392 Optimize WP Query in rocket_url_to_postid() (#6403)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabrisrp authored and wordpressfan committed Mar 15, 2024
1 parent b3dd96e commit cfbfe6e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions inc/functions/posts.php
Expand Up @@ -249,8 +249,13 @@ function rocket_url_to_postid( string $url ) {
*/
$query = (array) apply_filters( 'rocket_url_to_postid_query_args', $query, $url );

$query['no_found_rows'] = true;
$query['update_post_term_cache'] = false;
$query['update_post_meta_cache'] = false;

// Do the query.
$query = new WP_Query( $query );

if ( ! empty( $query->posts ) && $query->is_singular ) {
return $query->post->ID;
} else {
Expand Down

0 comments on commit cfbfe6e

Please sign in to comment.