Home › Forums › Front-end Issues › Match current user id to user relationship field › Reply To: Match current user id to user relationship field
I am doing this inside a template (archive). I updated my code with WP_Query
<?php $user_id = get_current_user_id();
echo $user_id;?>
<?php $$args = array(
'post_type' => 'arende',
'meta_key' => 'utfors_av',
'post_status' => 'publish',
'posts_per_page' => -1,
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'utfors_av',
'value' => $user_id, //array
'compare' => '=',
)
)
);
$query = new WP_Query($args);;?>
But this returns the same result as mine did before.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.