Home › Forums › Front-end Issues › Field Type "User", only show the posts that the "User" is selected › Reply To: Field Type "User", only show the posts that the "User" is selected
This is what I have so far and its not pulling any posts…
<?php // args $args = array( 'numberposts' => -1, 'post_type' => 'caregiver-updates', 'meta_key' => 'user_id', 'meta_value' => $current_user->ID ); // get results $the_query = new WP_Query( $args ); // The Loop ?> <?php if( $the_query->have_posts() ): ?> <ul> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <li> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </li> <?php endwhile; ?> </ul> <?php endif; ?> <?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
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!
🗓️ Just one more day until the next session of ACF Chat Fridays! Make sure to register for the latest updates on what’s coming in ACF 6.1!— Advanced Custom Fields (@wp_acf) March 30, 2023
📆 Friday 31st March 3pm UTC
👉 Register here - https://t.co/3UtvQbDwNm pic.twitter.com/7xtEJakeQN
© 2023 Advanced Custom Fields.