plugins - How to make a page both “private” and “password protected”

I’m working on a website which requires these two type of access for each post. (I mean, each post can be viewable in bo

I’m working on a website which requires these two type of access for each post. (I mean, each post can be viewable in both of these cases)

1- Registered users in specific groups should be able to view the post.

2- Non-registered users should be able to view the post using a password.

I tested different plugins and settings to implement these scenarios but with no success. Any help?

I’m working on a website which requires these two type of access for each post. (I mean, each post can be viewable in both of these cases)

1- Registered users in specific groups should be able to view the post.

2- Non-registered users should be able to view the post using a password.

I tested different plugins and settings to implement these scenarios but with no success. Any help?

Share Improve this question asked Jun 7, 2019 at 14:14 SiaSia 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Im really inexperienced with wordpress but i googled a few sec on google and maybe this will help.

function is_user_logged_in() {

    $user = wp_get_current_user();

 //Try to detect if the user is in a group here

    return $user->exists();

}

Maybe you can try to do something with the page if the user is detected as user and in what group it is.

Source: https://developer.wordpress/reference/functions/is_user_logged_in/

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

相关推荐

  • plugins - How to make a page both “private” and “password protected”

    I’m working on a website which requires these two type of access for each post. (I mean, each post can be viewable in bo

    4小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信