Skip to content

Commit

Permalink
Merge branch 'caveat-note' of github.com:globeandmail/sophi-for-wordp…
Browse files Browse the repository at this point in the history
…ress into caveat-note
  • Loading branch information
Sidsector9 committed Apr 25, 2022
2 parents a1a7387 + 36b1dc4 commit ecdbf84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Note that you need to add `data-sophi-feature=<widget_name>` to the wrapper div

#### Caveats
While the above query integration works just fine, it has been observed that on VIP infrastructures, `WP_Query` returns 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. Also remember to whitelist `get_posts` by adding the following inline comment so that PHPCS doesn't throw a warning:

`phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts`

In addition to using `get_posts`, it would be good practice to add a comment explaining the usage of it so that developers new to it don't swap it for `WP_Query`.
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Note that you need to add `data-sophi-feature=<widget_name>` to the wrapper div

== Caveats ==
While the above query integration works just fine, it has been observed that on VIP infrastructures, `WP_Query` returns 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. Also remember to whitelist `get_posts` by adding the following inline comment so that PHPCS doesn't throw a warning:

`phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts`

In addition to using `get_posts`, it would be good practice to add a comment explaining the usage of it so that developers new to it don't swap it for `WP_Query`.
Expand Down

0 comments on commit ecdbf84

Please sign in to comment.