Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have the following code to list the member's post that they created. However it is listing all posts. Anyone know how to fix it? Thank you!

    <?php

if ( is_user_logged_in() ) {
  global $current_user;
  get_currentuserinfo();
  echo 'User ID: ' . $current_user->ID . "\n";
  $args=array(
    'member' => $current_user->ID,
    'post_type' => 'listing',
    'post_status' => 'publish, private',
    'posts_per_page' => '10'
  );
  $my_query = null;
  $my_query = new WP_Query($args);
  if( $my_query->have_posts() ) {
    echo 'Your Posts';
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
      <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
      <?php
    endwhile;
  }
  wp_reset_query();  // Restore global post data stomped by the_post().
}
?>
share|improve this question
add comment

1 Answer

There is no member argument for WP_Query, you want to pass the user ID as author.

share|improve this answer
    
Thank you SO much! –  ellaj Feb 6 '13 at 19:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.