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 created one page for posts and changed the default post page to that page in Settings > Reading. When registering for the site the default new user role is subscriber.

The problem is after the login when I click on my diaryview page it shows all the posts of other users but I want to see only my posts in my diaryview post page.

How can I see only my posts on this page?

share|improve this question
2  
possible duplicate of Code needed to only show users own posts in a multi-user account –  kaiser Sep 12 '12 at 23:33

1 Answer 1

Try using wp_query

Here is the codex link:

WP_Query - Docs - WordPress

Here is an example of something that may help:

global $current_user;
      get_currentuserinfo();
$authorID = $current_user->ID;
    $args = array(
              'post_type' => 'post',//or whatever you need
              'posts_per_page' => 5,
              'author' => $authorID
              );

    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query($args);

You could use this in you own template page to display only the current user's posts.

share|improve this answer

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.