简体   繁体   中英

Wordpress access to the private posts for specific users

I'm a bit confused. By default, WordPress is showing 404 error, when someone is trying to open private post. Can I extend that logic a bit? I need to show that post for the specific user:

if ( show_post_to_the_user(get_current_user_id()) {
  // show this post
}

I've tried to use filter, but it didn't helped. 过滤器,但没有帮助。

             When you call post in back end  then post status give both
             $args = array(
             'orderby'          => 'date',
             'order'            => 'DESC',
             'post_type'        => 'post',
             'post_status'      => 'publish,private',
             'posts_per_page' => 6,
               );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM