3 Responses to Assigning a capability to Guests

  1. George January 22, 2016 at 7:45 pm #

    Hi Moises,

    The filter groups_user_can accepts 3 parameters one of which is user object. If the user is not logged in, then there is no user obj.

    Kind regards,
    George

  2. Moises January 22, 2016 at 12:15 am #

    I know I might be simplifying the code but would something similar to this would work?

    add_filter( ‘groups_user_can’, ‘my_force_cap’, 1, 3);
    function my_force_cap(){
    if (!is_user_logged_in()){
    return true;
    }
    }

  3. George January 19, 2016 at 1:02 pm #

    Hi Moises,

    Sorry but no, access restrictions can only apply to registered users.

    Kind regards,
    George

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share