-
Notifications
You must be signed in to change notification settings - Fork 7
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
add caveat to README about the usage of get_posts instead of WP_Query #242
Conversation
@Sidsector9 do you think it's worth including a code snippet here for how that might work? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but hoping to get a couple others to review/confirm before merging
README.md
Outdated
@@ -113,6 +113,10 @@ Note that you need to add `data-sophi-feature=<widget_name>` to the wrapper div | |||
</div> | |||
``` | |||
|
|||
#### 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! |
Description of the Change
Added a caveat surrounding the usage of WP_Query on a VIP environment.
Checklist:
Changelog Entry
Credits
Props @Sidsector9