You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we moved over the deprecated WPCS VIP sniffs over to VPCS here, the former PostsPerPageSniff on WPCS VIP became known as NoPagingSniff on VIPCS and the checks for posts_per_page were removed, as the WordPress.WP.PostsPerPage.posts_per_page_posts_per_page sniff was intended to be used instead. However, at the time, it wasn't realized that the WPCS PostsPerPage sniff did not check for values of -1.
After a brief discussion with @jrfnl, the approach may be to refactor the upstream sniff to allow for a range of values to check for, rather than a boolean property for checking against -1.
Regardless, no action is going to happen before 2.2.0 is released, so I'm punting to 2.3.0.
Activity
GaryJones commentedon Sep 3, 2020
After a brief discussion with @jrfnl, the approach may be to refactor the upstream sniff to allow for a range of values to check for, rather than a boolean property for checking against
-1.Regardless, no action is going to happen before 2.2.0 is released, so I'm punting to 2.3.0.
rebeccahum commentedon Nov 20, 2020
After talking to @jrfnl, we'll wait for WPCS 3.0 to be released.
rebeccahum commentedon Mar 1, 2021
Another code snippet I'd like to see flagged:
GaryJones commentedon Mar 1, 2021
numberpostsisn't used withWP_Query- see https://developer.wordpress.org/reference/classes/wp_query/#pagination-parameters which showsposts_per_pageandnopaging.numberpostsis used withget_posts()- see https://developer.wordpress.org/reference/functions/get_posts/#parametersget_comments()andget_pages()have anumberargument, but the default is for all items to be returned, so folks can just leave thenumberout.rebeccahum commentedon Mar 2, 2021
Er, whoops, fixed. It should be flagged in a
get_posts()context regardless.feat: flag posts_per_page/numberposts set to -1
feat: flag posts_per_page/numberposts set to -1
feat: flag posts_per_page/numberposts set to -1
GaryJones commentedon Mar 22, 2026
Closed in #882