Limiting the Number of User Posts to Their Own Posts

I have set users to only see their own posts. But the total number of articles is still visible. Can we limit it to its

I have set users to only see their own posts. But the total number of articles is still visible. Can we limit it to its own number of articles? How can it be done without plugins? related picture here:

.jpg

I restricted the users to their own posts with the code below. But as the picture above shows, although the publication is one, the number of publications seems to be four. How can I make the number of publications?

function posts_for_current_author($query) {
    global $pagenow;
 
    if( 'edit.php' != $pagenow || !$query->is_admin )
        return $query;
 
    if( !current_user_can( 'edit_others_posts' ) ) {
        global $user_ID;
        $query->set('author', $user_ID );
    }
    return $query;
}
add_filter('pre_get_posts', 'posts_for_current_author');

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742277944a4413941.html

相关推荐

  • Limiting the Number of User Posts to Their Own Posts

    I have set users to only see their own posts. But the total number of articles is still visible. Can we limit it to its

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信