Redirecting by role from a button

You could try something like the code below. <?php /** * Use the two lines below if the user_id is not available * via get_current_user_id at this point in code execution. * * $user_id = apply_filters( ‘determine_current_user’, false ); * wp_set_current_user( $user_id ); */ $current_user_id = get_current_user_id(); $user_data = get_userdata( $current_user_id ); $user_roles = $user_data->roles; … Read more

How to add custom user role into wordpress

Example: add_role(‘student’, __( ‘Student’), array( ‘read’ => true, // Allows a user to read ‘create_posts’ => false, // Allows user to create new posts ‘edit_posts’ => false, // Allows user to edit their own posts ‘edit_others_posts’ => false, // Allows user to edit others posts too ‘publish_posts’ => false, // Allows the user to publish … Read more