How to query for posts with a null or blank post_name?

If you want to use WP_Query: $no_title_posts = new WP_Query(array(‘name’=>”,’posts_per_page’=>-1); That will search all posts with empty name. The posts_per_page = “-1” returns all posts because by default wp returns 10 or whatever number you have selected in your admin settings. if you want to retrieve it from other posts types (default is “post”), then … Read more

Query Posts multiple conditions

Try to use WP_Query as stated in this answer When should you use WP_Query vs query_posts() vs get_posts()?. $user_bids = array( ‘post_type’ => ‘post’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘duplicated’, ‘value’ => ‘0’, ‘type’ => ‘numeric’, ‘compare’ => ‘=’ ), array( ‘key’ => ‘accept’, ‘value’ => ‘1’, ‘type’ => ‘numeric’, ‘compare’ … Read more

Query all published post AND attachment with specific mime type

First of all if any is used for post_type field there can not be any other value given in array like in the question. Below is the modified args $args = [ ‘post_type’ => array_values(get_post_types([‘public’ => true])), ‘post_status’ => [‘publish’, ‘inherit’], ‘posts_per_page’ => 10 ]; Use posts_where filter add_filter(‘posts_where’, ‘add_search_mime_types’); $query = new WP_Query( $args … Read more

Querying on multiple taxonomies pulled from $_GET checkbox array not working?

Here: $search_values[‘tax_query’] = array ( You’re resetting the value of tax_query for every item in the foreach loop. It’s also being set to an invalid value: Important Note: tax_query takes an array of tax query arguments arrays (it takes an array of arrays). This construct allows you to query multiple taxonomies by using the relation … Read more