Support

Account

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(). ?>