Execute function only for specific user roles

You can exclude certain roles like this: 1- Create a function to check if the current user role is excluded: function isPasswordValidationSkipped() { // Fill this array with roles that you want to exclude from password validation $excludedRoles = [‘subscriber’]; $user = wp_get_current_user(); foreach ($user->roles as $role) { if(in_array($role, $excludedRoles)) { return true; } } … Read more

Display logged in user name and lastname on page

You can always do a var_dump() of $current_user to see what it contains. You’ll see there is a similar property to user_firstname: user_lastname. You’ll probably want a space between the first and last name, so a small edit should add the last name: function custom_shortcode_func() { ob_start(); $current_user = wp_get_current_user(); echo ‘Willkommen ‘ . $current_user->user_firstname … Read more