in WP documentation:
NB: This setting is saved to the database (in table wp_options, field wp_user_roles), so it might be better to run this on theme/plugin activation
It means that when you first run your code it is saved to db, and if you try to do it one more time it will not be changed becouse it is already in DB.. you should remove role before making changes..
Related Posts:
- Remove update nags for non-admins [duplicate]
- Allow Editors to edit pending posts but not draft ones
- wp_insert_user role not working
- How to target with css, admin elements according to user role level?
- Remove admin bar for subscribers
- Editor role cannot save custom theme options
- wordpress separate registration for different roles
- Display user role Name – not slug
- Add user settings to specific roles
- How to give new users two specific user role options upon WordPress user registration
- Hiding div based on user role
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- Do not execute If User is login as Administrator or any Specific Role
- Add post with approval by the admin
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- Shortcode for Listing Users from Meta Value?
- Array to string conversion error in PHP 7.2 when returning user role as class
- Noindex subscriber author page
- Query for user roles
- How can I call a specific file (via php) by referencing the logged-in username?
- Plugin: Front-end Editor – User role specific editable content?
- Execute PHP code only with specific user role
- Edit and delete permissions pages and posts
- How to Add a cutsom slug to my custom author role
- Execute function only for specific user roles
- Allow a user or role to view drafts and previews, but not other admin privileges?
- how to create a user rule that can only manage support tickets?
- Hide payment method based on user role AND minimum cart value
- Edit a function to take different actions based on user role
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- How to give custom roles the capability to edit one Menu instead of every Menu
- Add another role to a user when they click a button?
- Obtain wordpress user role
- How to properly create multiple conditions to redirect users roles to different pages
- Echo Option Value Based On WordPress User Role
- Role exception for a settings sub menu
- Allow BBPress participant role to trash topics
- Include administrator in author list
- How to connect database table to each registered wordpress user.
- Get author meta of all writers
- Switch-Case and user_role
- Forbid certain users to access a specific page
- How to lock users account until approvation
- How to create a User Role and give permission to only use Web Stories plugin?
- How to create custom user role without plugin?
- Custom Admin Menu Report for Specific User ID
- How to add custom user role into wordpress
- WordPress and event-driven programming – what is it about?
- How WordPress encrypt password? [duplicate]
- Retrieve POST data from AJAX call
- Adding a custom image upload size and making it selected by default?
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- Limit the Excerpt field in WP-Admin in words
- How to change / delete product short description in Woocommerce
- How do I show the featured images for my child pages on my parent pages?
- WP_Query loop, does not display special characters in title correctly
- How do I get current page ID in WordPress customizer file?
- How to run a php file that uses wordpress functions from command line?
- WordPress Ignoring .user.ini
- Cron events are disappearing, or cannot be updated in WordPress
- Prev/Next child navigation for current page modifications?
- Is there a built-in function to generate multiple paragraph tags based on a string with new line separators?
- Site downloads files instead of loading them
- Saving data from custom form in wordpress database
- Logout redirects to default page
- How to hide the author box of a specific user?
- Find out last 7 days of upload images, last week uploaded image from Gallery and display them in different pages
- Add date before entry title in Twenty Twelve
- Multidimensional Array
- Make post title active
- WordPress theme showing blank page
- Php code error in wordpress if else statements [closed]
- WordPress is removing query variables like page, p from the URL of a custom static page
- PHP identify duplicate words in a text string against a list of words
- Get the list of post categories
- Wrap title and excerpt in a div (latest posts block)
- How to access all meta data for RSS feed?
- Change extension to .jpg when webp is not supported
- how can i redirect dynamic URL in worpress base on ID in htaccess or wp-config or function.php
- Multiple AJAX handler functions conflict in functions.php
- HTTPS Just won’t render CSS
- ACF values to Script with auto refresh
- PHP Error in WordPress Theme
- PHP 7.2 Challenge
- WordPress and WordPress-test-lib not getting added to tmp folder
- Remove generated category and tag class names from woocommerce product & blog listings markup
- Blog Image and Title in Right Sidebar
- Creating a WordPress addon for ContactForm7 submission (.XML file export)
- wordpress query returning unexpected results
- How save data on user’s client cache
- How to always display full size image
- Updating Lat and Lng of posts automatically gives sporadic results
- How I can add div to menu?
- How to print redirected query string variables to the page?
- Multiple URL from Custom post name
- Admin-area broken through weird issues
- Display a query with multiple post types and same relationship on a single page
- Get string from array and start loop [closed]
- Custom query_posts() parameter
- wp_link_pages return value even when is condition inside if statement