0

I hope you can help me ... I already searched the information but I did not find anything useful.

I am doing a project where I created a post type (student_valuation) where the administrator places information about a member (student), there is a dropdown (student_name) to choose the student name.

I want to put this evaluation in a specific page for the student that will be logged. If someone has a query I can use ... thank you.

2
  • Hi. I'm not sure what exactly you are looking for... What do you want to hide? The student list? The page? The whole post type?
    – Johansson
    Commented Aug 11, 2017 at 21:46
  • Not understand the description but depends on the question title, you can wrap your wp_query in condition get_current_user_id(). Commented Aug 12, 2017 at 9:15

1 Answer 1

1

try this:

$args = array(
    'author' => get_current_user_id(),
    'post_type' => 'YOUR_CUSTOMPOST_TYPE',
);
$author_posts = new WP_Query( $args );
if ($author_posts->have_posts()): while ($author_posts->have_posts()) : $author_posts->the_post();

     //DISPLAY CONTENTS HERE

endwhile; endif;
wp_reset_postdata();
wp_reset_query();

replace YOUR_CUSTOMPOST_TYPE with your post type, what it does is finds posts of certain post type whose author is currently logged in user.

Currently it queries posts whose author is currently logged in user, you can list other users by using get_users(), full description here, and set 'author' => get_current_user_id() to 'author' => $ID_OF_USER

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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