Foreach loop inside an array_merge

Someting like this? foreach ($subscribers as $user) { $users[] = array( ‘label’ => $user->display_name, ‘value’ => $user->display_name ); } Then do the array_merge with $users

How to print Array values of custom Fields Meta?

Based on the screenshot I assumed is var_dump of your $item The code should look like <?php $item = get_post_meta($post->ID, ‘occupationalCategory’, false); ?> <?php print_r( $item[‘occupationalCategory’][0] ); ?>; <?php print_r( $item[‘occupationalCategory’][1] ); ?> $item contains array, with a element which key is ‘occupationalCategory’, this element points to other array with two elements

Warning: in_array() null given in PHP function

Well first you have this code // no matter what the value here, you can forget about it (because in the next line of code you assing a new value to the same variable) $post_types = apply_filters( ‘sortable_wordpress_gallery_post_types’, array( ‘post’ ) ); // only this really matters $post_types = apply_filters( ‘sortable_wordpress_gallery_’ . $this->id . ‘_post_types’, … Read more

How to say if meta_value is greater than 0 in an array?

As documented, you can use meta_compare: $args = array( ‘meta_key’ => ‘userfunds’, ‘meta_value_num’ => ‘0’, ‘meta_compare’ => ‘>’, ); Note that I changed meta_value to meta_value_num. This ensures the values is treated as a number for the comparison. You’d probably be ok without it, but it doesn’t hurt.

Tax query with multiple terms in pre_get_posts

Just use: ‘terms’ => $rt_cat_id I’ll work for both array and single-based values. Or you can simplify your code as follows: if( isset( $_GET[ ‘listing_cat’ ] ) ) { $tax_query[] = array( ‘taxonomy’ => ‘listing_category’, ‘field’ => ‘id’, ‘terms’ => $_GET[ ‘listing_cat’ ] ); }