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

WPQueryParamsSniff incorrectly flags get_users() call #729

Closed
2 tasks
swissspidy opened this issue Nov 22, 2022 · 1 comment
Closed
2 tasks

WPQueryParamsSniff incorrectly flags get_users() call #729

swissspidy opened this issue Nov 22, 2022 · 1 comment

Comments

@swissspidy
Copy link

Bug Description

When using code like get_users( [ 'exclude' => 123 ] ), you'll get a warning like

Using `exclude`, which is subsequently used by `post__not_in`, should be done with caution, see https://docs.wpvip.com/how-tos/improve-performance-by-removing-usage-of-post__not_in/ for more information.

This is wrong because this is not a WP_Query call and does not use post__not_in.

Querying that many users is still not super ideal, but I think this warrants its own sniff that is less confusing.

Minimal Code Snippet

get_users( [ 'exclude' => 123 ] )

Error Code

Environment

Use php -v and composer show to get versions.

Question Answer
PHP version 8.1.12
PHP_CodeSniffer version 3.7.1
VIPCS version 2.3.3

Additional Context (optional)

Tested Against master branch?

  • I have verified the issue still exists in the master branch of VIPCS.
  • I have verified the issue still exists in the develop branch of VIPCS.
@swissspidy
Copy link
Author

Duplicate of #672

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants