This allows plugins to easily hijack the default role while they’re active.
// Hijack the option, the role will follow!
add_filter('pre_option_default_role', function($default_role){
// You can also add conditional tags here and return whatever
return 'subscriber'; // This is changed
return $default_role; // This allows default
});
I use it to make sure some plugins that need subscriber roles get it regardless of Administrator attempts to change 🙂
Regards.
Related Posts:
- Menu page with list of users
- How to allow an user role to create a new user under a role which lower than his level only?
- What the user_status column?
- How to loop through each user id?
- How to programmatically add a user to a role?
- Prevent user creating new users with specific roles
- Roles at registration (classipress)
- Order users by custom user meta
- List total number of users that are authors
- Auto Delete Users (auto_delete_users)
- Is there a way to set the user Role based on email domain
- How to customize wp_signon()
- Can’t manage to make translate_user_role() work
- WPMU – new users are automatically subscribed to the main blog – how to prevent that?
- User registration approval based on role selected
- exclude roles from overview
- get approved users only ( ultimate member plugin )
- New user created as Participant rather than Contributor [closed]
- Query users which have same dynamically generated roles as the current user
- Displaying different in-page content to cliente/admin
- How to create user specific pages (not user role!)?
- How to change a user’s role conditionally to expire after two weeks
- Limit number of users a role can create
- How to get a users list by who created them?
- Customising “user ids” and add to ‘user’ panel in the admin area
- How to hide some users to unlogged users [closed]
- List of users with email and role
- How to create a front facing user sign up, log in and profile pages like FoodGawker.Com [closed]
- Add a second role when registering programmatically
- Easily adding multiple existing users to a multisite site
- What would cause wp_insert_user role to work sporadically?
- How to Enable registration email for a custom user role?
- Add role selector to custom registration page
- Multiple user role on registration
- User / membership Plugin [closed]
- Can someone help me out? Why isn’t this working?
- A different role for each site in a multisite
- Select dropdown with 2 choices from foreach
- List users of specific role instead of removing them with specific role
- add user role selection to registration form [duplicate]
- file upload user profile
- How to assign role to a custom registration form?
- User role can’t be set
- User has empty instead of custom role when logged in
- How to add default folders to Every registered User when registered in WordPress site?
- Condionally/limited emails from system (cantact-form, registration, passwd reset)With
- If the current user is an administrator or editor
- How to check if a user is in a specific role?
- How to change the default registration email ? (plugin and/or non-plugin)
- allow editors to edit menus?
- Getting a List of Currently Available Roles on a WordPress Site?
- How to change a user’s role?
- Editor can create any new user except administrator
- Is there way to rename user role name without plugin?
- How to create a clone role in wordpress
- How to add a Capability to a User Role?
- Separate registration and login for different roles
- Why are my roles not visible in a Multi-site/Network?
- How can I get a list of users by their role?
- How to get role of user
- Remove Ability for Other Users to View Administrator in User List?
- Adding fields to the “Add New User” screen in the dashboard
- How to allow editor to edit privacy page / settings only?
- How do I make a draft post accessible to everyone?
- Reset default roles and capabilities
- Find out if logged in user is not subscriber
- Display user registration date
- add_role() run only once?
- Whats the best way to share user data across multiple WordPress websites?
- Send user activation email when programmatically creating user
- Groups of capabilities: users with multiple roles?
- User-edit role setting distinct from wp_capabilities? [closed]
- What do unfiltered_html and unfiltered_upload actually filter?
- wp_update_user not updating
- Check if user is admin by user ID
- Temporary capability for current_user_can()
- Allowing users to edit only their page and nobody else’s
- alphabetically order role drop-down selection in dashboard
- Create custom user role (client) that can create another custom user role (employee) of that client
- WordPress auto login after registration not working
- wordpress multisite, how to keep user on subdomain throughout registration process?
- Execute a function when admin changes the user role
- Is it possible to add new user Roles?
- Allow roles below admin to add subscribers only
- How to let contributors to create a new revision(draft) editing their published posts
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- How to limit user registration to a specific set of domains?
- Hide Admin Menu for Specific User ID who has administrator Role
- Problem with Hebrew characters in username
- Remove email verification when new user register
- How to set up User email verification after Signup?
- How to let user set password on registration
- How to hide media uploads by other users in the Media menu?
- Show admin bar only for some USERS roles
- How to display custom user meta from registration in backend?
- Grouping users under parent user
- How to remove administrator role in settings -> general -> New User Default Role?
- how to disable user confirmation from administration?
- Temporarily give ‘manage_options’ capability