W
W
William2021-11-28 02:07:36
WordPress
William, 2021-11-28 02:07:36

How to display a cycle of posts belonging to the author only to the author himself?

in the author.php page I display the post loop owned by the author

$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));

$args = array(
            'post_type' => 'post',
            'post_status' => 'pending',
            'posts_per_page' => 3,
            'author' => $curauth->ID,
        );
/////.....


but how to display it only to the author himself?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
William, 2021-11-30
@william666

if($curauth->ID == get_current_user_id()) {

///

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question