get_posts query matches too many results

Well, you need to include the type comparison, or alphanumeric comparison is applied here. In this case, you should add ‘type’ => ‘numeric’. Using Your Class Function <?php public function list_related_docs($id){ $docs_args = array( ‘post_type’ => ‘publication’, ‘post_status’ => ‘publish’, ‘posts_per_page’=> -1, ‘orderby’ => ‘meta_value_num title’, ‘order’ => ‘ASC’, ‘meta_key’ => ‘fund_list_order’, ‘limit’ => 4, … Read more

Query Posts, order by meta value

Your query seems fine but there are couple of issues. Instead of your code (from wp_reset_query(); to wp_reset_query();) use following code and let us know what is the output. $new_args = array( ‘post_type’ => ‘datensatz’, ‘post_status’ => ‘draft’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘completeness’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’, ); $my_new_query = new WP_Query( … Read more

Query by key or author

You don’t really need to use the &new WP_Query just new WP_Query. The following code will resolve your problem. add_filter( ‘posts_search’, ‘q166788_search_modify’, 10, 2 ); function q166788_search_modify( $sql, $query ){ // Only if our variable is true we do the black magic if ( ! isset( $query->query_vars[‘search_conditional_toggle’] ) || $query->query_vars[‘search_conditional_toggle’] !== true ){ return $sql; … Read more

Avoid duplicate while merging two query post

Before I start, you have a problem with your meta_query. You should not use relation for a single inner meta_query array relation (string) – The logical relationship between each inner meta_query array when there is more than one. Possible values are ‘AND’, ‘OR’. Do not use with a single inner meta_query array. Your first query … Read more