0

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?

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.org/reference/functions/is_user_logged_in/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.