Conditional statement within an array
-
Hi I have the following array, but really I only want to query the gender if the $gender variable exists, as conditional statements can’t be located within a php array, are there any clever / obvious suggestions I maybe overlooking on how to go about this?
$args = array( 'role' => 'talent', 'order' => 'DESC', 'orderby' => 'user_registered', 'meta_key' => 'position', 'number' => '15', 'meta_query'=> array ( array( 'key' => 'picture', 'value' => array(''), 'compare' => 'NOT IN' ), array( 'key' => 'gender', 'value' => $gender ), ) );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Conditional statement within an array’ is closed to new replies.