Custom query with orderby meta_value of custom field

You can define the meta key for orderby parameter using the old method (I tested on WP 3.1.1)… query_posts( array( ‘post_type’ => ‘services’, ‘order’ => ‘ASC’, ‘meta_key’ => ‘some_key’, ‘orderby’ => ‘meta_value’, //or ‘meta_value_num’ ‘meta_query’ => array( array(‘key’ => ‘order_in_archive’, ‘value’ => ‘some_value’ ) ) ) );

Extending the search context in the admin list post screen

I solved filtering the query by adding the join on the postmeta table and changing the where clause. tips on filtering the WHERE clause (often require regular expression search&replace) are here on codex: add_filter( ‘posts_join’, ‘segnalazioni_search_join’ ); function segnalazioni_search_join ( $join ) { global $pagenow, $wpdb; // I want the filter only when performing a … Read more