WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
possible duplicate of Code needed to only show users own posts in a multi-user account – kaiser Sep 12 '12 at 23:33

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;
$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


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.