Wildcard for Query
-
function kia_meta_search( $args ){ // this $_GET is the name field of the custom input in search-author.php $searchGender = ( isset($_GET['gender']) ) ? sanitize_text_field($_GET['gender']) : false ; $searchDiocese = ( isset($_GET['diocese']) ) ? sanitize_text_field($_GET['diocese']) : false ; if ( $searchGender || $searchDiocese || $searchCivilStatus ){ $args['meta_query'] = array( 'relation' => 'AND', array( 'key' => 'gender', 'value' => '*male', 'compare' => '=', ), array( 'key' => 'diocese', 'value' => $searchDiocese, 'compare' => '=', ) ); } return $args; }
How can it search for a wildcard? I tried to direct change the value with ‘*male’ like given above but it doesn’t give any result but when I tried ‘Male’ or ‘Female’ there are results.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Wildcard for Query’ is closed to new replies.