[wp-trac] [WordPress Trac] #16742: Meta query doesn't work with $wp_query->set()
WordPress Trac
wp-trac at lists.automattic.com
Thu Mar 3 21:42:30 UTC 2011
#16742: Meta query doesn't work with $wp_query->set()
--------------------------+------------------------------
Reporter: scribu | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------------
Comment (by greuben):
Also this one generates some invalid sql
{{{
add_action( 'pre_get_posts', function( $query ) {
$query->set( 'meta_key', 'test' );
$query->set( 'orderby', 'meta_value' );
return $query;
} );
}}}
sql query
{{{
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND
wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR
wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY
wp_postmeta.meta_value DESC LIMIT 0, 10
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16742#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list