• Resolved davidspan

    (@davidspan)


    When I try to set role:

    $user_id->set_role(‘contributor’);

    I get this error:
    Fatal error: Call to a member function set_role() on a non-object in…

    What am I missing?

Viewing 1 replies (of 1 total)
  • Thread Starter davidspan

    (@davidspan)

    Ok I found problem, I was missing this
    $user_id_role = new WP_User($user_id);

    then changed this
    $user_id_role->set_role(‘contributor’);

Viewing 1 replies (of 1 total)
  • The topic ‘set_role’ is closed to new replies.