add caveat to README about the usage of get_posts instead of WP_Query#242
Merged
add caveat to README about the usage of get_posts instead of WP_Query#242
Conversation
Contributor
|
@Sidsector9 do you think it's worth including a code snippet here for how that might work? |
jeffpaul
previously approved these changes
Apr 21, 2022
Contributor
jeffpaul
left a comment
There was a problem hiding this comment.
Looks good, but hoping to get a couple others to review/confirm before merging
jeffpaul
reviewed
Apr 22, 2022
|
|
||
| #### Caveats | ||
|
|
||
| While the above query integration works just fine, it has been observed on [WordPress VIP](https://wpvip.com/) infrastructure that `WP_Query` may return latest posts instead of the posts curated by Sophi. A workaround for this is to use [`get_posts()`](https://developer.wordpress.org/reference/functions/get_posts/) instead. |
Contributor
There was a problem hiding this comment.
It may be worth also calling out here that should an integration need to switch to using get_posts() that we'd recommend a strong comment in that codebase to call out WHY so that some future engineer doesn't come along and swap it out for WP_Query and totally break things.
…ress into caveat-note
|
Kudos, SonarCloud Quality Gate passed! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Description of the Change
Added a caveat surrounding the usage of WP_Query on a VIP environment.
Checklist:
Changelog Entry
Credits
Props @Sidsector9