[wp-trac] [WordPress Trac] #28399: Allow WP_Query to query by comment_count column of CPT/posts table
WordPress Trac
noreply at wordpress.org
Thu May 29 14:50:46 UTC 2014
#28399: Allow WP_Query to query by comment_count column of CPT/posts table
---------------------------+-----------------------------
Reporter: ramon fincken | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: trunk
Severity: normal | Keywords:
Focuses: ui |
---------------------------+-----------------------------
In the current WP_Query, it is possible to order results by comment_count
ASC/DESC.
But is it not possible to query the table based on this CPT/posts table
column. Therefor it is impossible to (for example) query posts without any
comment or posts having over 10 comments.
I propose a diff to use WP_Query in the following way (building on the
syntax from meta_query and tax_query)
a) Easy call:
$args['comment_count'] = n; n >= 0
b) Extended call:
$args['comments']['count'] = n; n >= 0
Optional in this call:
$args['comments']['compare'] = Compare; Compare: =, !=, >, >=, <, <=
I will extend this ticket with a patch diff file (trunk) along with a
testset (has-patch).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28399>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list