By the looks of it, there’s a plugin to achieve exactly this, so save you rolling your own for it.
The plugin is: https://wordpress.org/plugins/permalinks-customizer/
I installed it to test that it does what you’re looking for. Here’s a screenshot that shows what you’d do:
Related Posts:
- Adding fields to the “Add New User” screen in the dashboard
- How to check if a user exists by a given id
- Difference between the_permalink() and get_permalink() function
- How to display a public profile page for registered users with custom slug?
- Possible to search by author name with default WordPress search function?
- paginate_links() don’t properly work in search.php?
- Get a list of all available fields in the User Profile
- Logout redirect to current page – function
- How to paginate the get_users function?
- Refresh page after form action
- How to display random users with avatars
- How to manually activate user in dashboard only by admin
- Add admin bar link to edit author
- Add new user : make the fields First Name and Last name required
- wp_delete_user with username
- Convert hyphen to underscore in permalinks
- How to add .htaccess code through a function?
- Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php
- Order get_users() by last login date. Is it possible?
- Authors details such as social media links, emails etc → Is this Meta or something else?
- Display the number of user comments
- How can I tell when a user is logged in?
- how to get and display logged in user’s recently read posts
- Displaying a random user with a shortcode
- How to update BuddyPress xprofile fields programmatically? [closed]
- How to detect first visit of a user?
- Can I pass two roles to the function get_users?
- How can I add an image field to BuddyPress Extended Profile Fields? [closed]
- Adjust which tempalte a page uses with a function?
- Generate permalinks
- Create dropdown of users in admin dashboard
- Disable shortlinks like ?p=1234 to prevent scraping
- WordPress Content Security Policy and Subresource Integrity
- password protected post policy
- Remove the deleted users avatar from list
- Hide Author.php template from specific user role
- Get Current User info using wp_localize_script, in functions.php
- How to add custom fields to my custom registration form
- How to automatically remove links from WordPress Biographical Info?
- Manipulate Permalink
- How do I redirect all 404 error url to Subcategory url
- create shortcode to list users with specific meta key value
- Don’t delete a page if it holds users
- Commenter should see only his comments in wordpress
- Allow Post Author to be 0 on Update
- How to make custom column Admin>Users sortable?
- Execute a ultimate member action when user role is updated
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- wp-comment author- url +, email filter hook
- Force to use STRONG users password and implement rule to prevent REUSE [closed]
- Change label for registration Fields
- check if author has published posts in custom post type, then send mail
- How to get correct URLs in network wide menu (Multisite)?
- Where to add the permalink in this function?
- Using wp_redirect and .htaccess to re-route searches (and pass along the remaining GET vars)
- paginate_links() don’t properly work in search.php?
- Remove category from url
- How to fix get_the_category function returning incorrect slug?
- Condition OR for current user ID
- Author Date Function not working as expected [duplicate]
- Test if a post exists by category and date
- How to Use Global Variables Inside Header and Footer
- Secondary Menu and Logged In Users
- Why get_user_by() doesn’t work in my code?
- How to rewrite wordpress search to work on specific category
- Filter to wp_list_authors
- How to properly refresh page after form action?
- I’ve removed my /author/ slug but it clashes with new and existing pages. Any fixes?
- How to add array [closed]
- Add Link to Users List (Backend) to open each users front-end profile
- Disabling Author Page only for subscribers
- Setting Permalinks in wp_config or functions file?
- Suggest Users basing on User taxonomy
- Showing user profile data on front-end
- Modify function to only return values for the user that’s logged in
- Redirect to post after publish or update a published post
- loginout function customization
- User meta and public function security
- Internet Explorer opens links to .msi files as text in a new tab
- call wp_insert_user in custom class doesnt work
- Get users with different roles and call function on each of them (user_meta)
- If no author posts, echo out some text
- Show errormessages on wrong username/password on custom loginform?
- How can I show different content for different user-levels?
- Change author permalink using htaccess?
- Custom user role still showing up after deletion, ideas?
- Check if excerpt is empty at loop-portfolio
- Show the online status of the current post’s author
- Exclude javascript in certain page url and all following url’s after forward slash
- get USER ID in functions.php using user_register action
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Changing functions.php and .htaccess files
- WordPress is adding pagination for all pages not only for blog page, How to remove pagination for all pages except blog/posts page?
- Whats the proper way to add a new user via a front end form?
- How to add user_registered time in human_time_diff() wordpress
- sort by date in users
- Include posts under a custom taxonomy in author.php
- Add custom css to specific user
- Custom permalink for post of one category
- How to Programmatically Replace Characters in WooCommerce Product Slugs?