Tag Info

Hot answers tagged


I don't think there's a way to do it without using filters. Using posts_clauses you could do: function wpse163696_posts_clauses( $pieces, $query ) { if ( $query->get( 'orderby' ) != 'dealer_date' ) { return $pieces; } global $wpdb; $order = $query->get( 'order' ); $pieces[ 'join' ] .= $wpdb->prepare( ' LEFT JOIN ...


You are sorting it incorrectly. You will need to check for artist-status meta key with meta_query and sort by last-name metakey. Here is your query. $args = array( 'post_type' => 'artist', 'posts_per_page' => -1, 'meta_key' => 'last-name', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array ( ...


The original code is not so bad. It just is missing the meta_key parameter. Example: $theusers = get_users( array( 'role' => 'contributor', 'meta_key' => 'first_name', 'orderby' => 'meta_value', ) );


You have a couple of errors there, I believe. 1) There is no such parameter as 'numberposts'. Perhaps you mean 'posts_per_page'? That is what you should use to determine the number of posts to display. 2) When ordering by meta value, the correct syntax should be: 'orderby' => 'meta_value', 'meta_key' => 'key_name', Where key_name is the custom ...

Only top voted, non community-wiki answers of a minimum length are eligible