Custom loop using a meta_value that is an array
-
Hi All,
I am currently trying to output one random entry from a custom post type. The post type has a custom field called ‘person_type’, the values in this field are an array, e.g. array(0=>’advisor’, 1=>’contributor’)
I am trying to set up a custom loop that pulls advisors only. The code I am using is:
$args = array( 'post_type' => $type, 'orderby' => 'rand', 'meta_key' => 'person_type', 'meta_value' => 'advisor' ); } $loop = new WP_Query($args);
This doesn’t return anything.
I have tried changing the meta_value to:
'meta_value' => array('advisor'),
however this throws up an error saying:
Warning: trim() expects parameter 1 to be string, array given in /wp-includes/meta.php on line 526
In other words it expects a string, any help would be appreciated!
Thanks,
Scoe
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom loop using a meta_value that is an array’ is closed to new replies.