[wp-trac] [WordPress Trac] #34474: sql error with wp_query and posts_per_page param
WordPress Trac
noreply at wordpress.org
Wed Oct 28 16:12:41 UTC 2015
#34474: sql error with wp_query and posts_per_page param
--------------------------+----------------------
Reporter: nicmare | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Query | Version: 4.3.1
Severity: normal | Resolution: invalid
Keywords: | Focuses:
--------------------------+----------------------
Comment (by boonebgorges):
Yeah, there's also a big warning at the top of that codex page that says
you should almost always avoid using `query_posts()` in plugins and themes
:) I strongly recommend that you use a proper `WP_Query` for your purposes
(or the 'pre_get_posts' filter). If you must use `query_posts()` in the
way you've described, make sure you `unset( $args['nopaging'] )` or
`$args['nopaging'] = true` before passing them to `query_posts()`. This'll
ensure that your arguments are internally consistent.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34474#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list