简体   繁体   English

Wordpress访问特定用户的私人帖子

[英]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. 默认情况下,当有人尝试打开私人帖子时,WordPress显示404错误。 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 the_content filter, but it didn't helped. 我尝试使用the_content过滤器,但没有帮助。

             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,
               );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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