I have a custom filed named endorsee-email that I want to use to filter post that have current_user's email. The value in custom field is populated on post submit so I know there is data.
I am using the following code but it does not work. What am I missing regarding meta_query with toolset fields.
<?php global $wpdb;
global $post;
$current_user = wp_get_current_user();
$c_u_email = $current_user->user_email;
$args = array(
'post_type' => 'endorsement',
'post_status' => 'publish',
'meta_query' = array(
'relation' => 'AND',
array(
'key' => 'wpcf-endorsee-email',
'value' => $c_u_email,
'type' => 'EMAIL',
'compare' => '='
)
)
);
$endorsements = get_posts($args);
print_r($endorsements);
?>
Reference post: https://toolset.com/glossary/wp_query/
My issue is resolved now. Thank you!