WP_Query get posts where post_name is empty
You can try this: $args = array ( ‘post_type’ => ‘books’, ‘name’ => ”, ‘post_status’ => array(‘publish, draft’), ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘book_isbn_id’, ‘value’ => ‘dummy’, ‘compare’ => ‘NOT EXISTS’, ‘type’ => ‘NUMERIC’, ), ), ); add_filter( ‘posts_where’, ‘custom_posts_where’ ); $query = new WP_Query( $args ); echo $query->request; where function … Read more