Wp query by 2 meta field – check if they exists / have value
Check the Codex. meta_query accepts an EXISTS comparison. $args = array( ‘post_type’ => ‘somepostype’, ‘meta_query’ => array( array( ‘key’ => ‘fname’.$userid, ‘compare’ => ‘EXISTS’, ), array( ‘key’ => ‘lname’.$userid, ‘compare’ => ‘EXISTS’, ) ) ); $query = new WP_Query( $args ); return $tempquery->found_posts; There is a note that… Note: Due to bug #23268, value is … Read more