Those names are stored in the option wp_user_roles
in the database table wp_options
.
So, the following will change the name of the subscriber
role:
$val = get_option( 'wp_user_roles' );
$val['subscriber']['name'] = 'PeDeBoi';
update_option( 'wp_user_roles', $val );
Apparently, this is harmless, but caveat emptor…
In your code, $wp_roles->roles[$role]['name'] = $new_role_name;
doesn’t work because it should be:
$wp_roles->roles[$role_name]['name'] = $new_role_name;
And $display_name
doesn’t make much sense.
Related Posts:
- Apply custom role capabilities to administrator (without plugin)
- Roles & capabilities GUI that does not create separate table
- How do I redirect upon login a specific user based on role?
- How to add another user to this remove_menu function?
- Add a new subscriber role using a function
- How to test for Super Admin
- Custom roles can’t access to wp-admin
- Custom registration URL lost when user makes signup mistake
- Custom function for specific user role
- Hide Author.php template from specific user role
- create shortcode to list users with specific meta key value
- Toggle User Roles with button
- How to change or add user role after getting post request data about pay? [closed]
- Execute a ultimate member action when user role is updated
- Allowing users to view private posts (pending approval)
- Allow Contributor to edit their own posts after Adm aproval
- How to add custom JavaScript in functions?
- How to set default post editor based on role?
- load CSS only for administrators on backend
- Adding additional roles on registration
- The Capability to choose post/page template
- How to add array [closed]
- Get users with different roles and call function on each of them (user_meta)
- How can I show different content for different user-levels?
- Custom user role still showing up after deletion, ideas?
- How to load a css file depending on the current role
- Allow user select role in wordpress default registration without plugin
- Remove check boxes and its label from screen option for custom role
- Add Change role button for list of user in an event
- How to show only specific category post by user role without plugin and restrict all other cats
- Change user role based on total number of items ordered
- Remove all video attachment, both files and post/postmeta from database?
- delete_user_meta for user in spesific group
- Change the second role depending on the first
- Restrict certain roles registrations by domain
- Multisite Admin Roles
- add_role menu pages are not visible
- Welcome Mails based on user role
- Get all users from role and add to dropdown (select) – wordpress, javascript
- Functions.php code that only runs on localhost?
- hook a functions to change wp-config from functions.php
- Extending auth_cookie_expiration based on user role
- Check if the user has explicitly set an excerpt
- Slugs as breadcrumbs for Pages
- Add inline css to theme
- Shortcode with custom content attribute?
- Add a Post Thumbnail to an RSS Feed with custom size
- Automatically add author’s name to post_tag
- Print Dashboard menu name and link
- Develop function get_template_part in functions.php
- Change comment_reply_link URL
- Ajaxing function in widget class
- How to display a default image for post thumbnail using functions.php?
- How to extract the variables out from “add_shortcode” function?
- Product Tags in Add New product as checkbox list [closed]
- Creating a child theme – functions.php code issue
- Run function when WordPress new multisite is created or ACF field is updated
- Setting Up Scheduled Tasks (For Scripts to Run)
- problem with has_post_thumpnail in foreach loop
- Frontend tag edit/submit form
- Find resources dynamically loading and change or add to the url
- Using shortcode content with nested shortcode
- how can I edit flexslider in woocommerce. [Urgent]
- Sections and tabs DRY – WordPress settings API
- current_time(‘timestamp’) seems to be different from the real current time
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Custom function causes a 503 error after a couple of hours
- How can I show my latest tweet in my wordpress blog?
- register_activation_hook for multiple functions
- Undefined index: action with code-snippets to change register page
- Why There Is No “get content by ID” Function
- Missing argument for the function
- get_next_posts_link() returns no result despite available posts
- Randomizing wp_tag_cloud() in child theme
- Init action and refresh page after form action
- Replace plugin function with a custom function?
- Combine two active_callbacks into one on theme customizer
- How to create shortcode with html and php content?
- wp_usermeta – Read from database, but save function broken
- remove/hide wp-editor
- Problems with functions.php! Error! [closed]
- Output comment_author in array
- Problem with shortcode inside a shortcode
- Add #primary at the end of navlink permalinks on single posts
- Is there anyway to force is_singular() to be true when not loading template?
- Postback redirect through add_action is not triggered
- How to add class dynamically from templates
- How to change form action of wp-login page with a function
- How to make an If Else on Excerpt Filter
- Translation Function missing text-domain [closed]
- Retrieve a custom form field modified by a filter
- Custom taxonomy not refreshing page on add
- Pagination in Search result
- Custom field not updating via functions upon publishing
- disable WP_error: authentication_failed
- Changing functions.php and .htaccess files
- Shortcode Variations?
- Code in functions.php appearing on front-end and dashboard [closed]
- Sessions in word press [duplicate]
- “woocommerce_output_related_products” not working