Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use WP_Query::get_posts directly #38104

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

Mamaduka
Copy link
Member

Description

Don't call WP_Query::get_posts directly after passing args to WP_Query to avoid duplicated queries.

Similar to #32700

How has this been tested?

All checks are passing.

Types of changes

Performance/Code Quality

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).
  • I've updated related schemas if appropriate.

@Mamaduka Mamaduka self-assigned this Jan 20, 2022
@Mamaduka Mamaduka added [Type] Performance Related to performance efforts Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts labels Jan 20, 2022
Copy link
Member

@aristath aristath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is for the $delete_query, I don't see any issues with using $delete_query->posts instead of $delete_query->get_posts().

This looks good to me 👍

@Mamaduka
Copy link
Member Author

Thanks for the review, Ari.

There's a discussion to make the method private, but I don't think this will happen because of backward compatibility.

@Mamaduka Mamaduka merged commit 6cf4446 into trunk Jan 20, 2022
@Mamaduka Mamaduka deleted the fix/dont-call-get-posts-directly branch January 20, 2022 08:18
@github-actions github-actions bot added this to the Gutenberg 12.5 milestone Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants