Please note that translate_user_role
doesn’t work in the front-end currently.
Here is a workaround, you can place this in your theme:
add_action( 'init', 'load_admin_textdomain_in_front' )
function load_admin_textdomain_in_front() {
if ( ! is_admin() ) {
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' );
}
}
Related Posts:
- Can’t manage to make translate_user_role() work
- allow editors to edit menus?
- How to create .pot files with POedit?
- How to change a user’s role?
- Translate a plugin using .po .mo files
- Is there way to rename user role name without plugin?
- How to create a clone role in wordpress
- How to make a WordPress plugin translation ready?
- Theme localization of “slugs” (custom post types, taxonomies)
- How to add a Capability to a User Role?
- How can I get a list of users by their role?
- How to get role of user
- 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
- How do I programmatically set default role for new users?
- add_role() run only once?
- How to get a translated string from a language other than the current one?
- How to print translation supported text with HTML URL
- How to get a localized version of WordPress from a repository?
- Localization: I want the backend: english and frontend in defined language
- Working with l10n contexts (_x etc)
- What do unfiltered_html and unfiltered_upload actually filter?
- wp_update_user not updating
- Temporary capability for current_user_can()
- How to integrate get_post_time with date_i18n function?
- Create custom user role (client) that can create another custom user role (employee) of that client
- gettext does not translate when called in ajax
- Is it possible to add new user Roles?
- Allow roles below admin to add subscribers only
- How to provide translations for a WordPress TinyMCE plugin?
- How to escape the single quote character in i18n translation strings?
- How to auto-translate custom user roles?
- Temporarily give ‘manage_options’ capability
- Gettext details
- REST API, get user role?
- Is WordPress’ is_user_logged_in() secure?
- How to force listing contributors in authors dropdown menu
- How to escape single and plural i18n text strings?
- Best pratice to make taxonomy terms translatable without changing slugs?
- Hide specific admin users’ posts
- Allow authors to edit only certain users
- How do I allow a specific Role in WordPress 3+ to only see certain plugins?
- How to update role capabilities
- Allow editors access to added plugins
- Temporarily disable user role login and replace with message
- How to filter the role selector?
- How to loop through each user id?
- Code needed to only show users own posts in a multi-user account
- How can I change a user role upon visiting a page?
- How to let the Contributor role preview unpublished posts?
- What is the purpose of an extra file for translation?
- What are the most used WordPress localization?
- Change role after the user has read all the posts in a category
- Do custom user roles have any default capabilities?
- Difference between 2 internationalization (i18n) functions __() & _e()
- Filter available WooCommerce payment gateways by role [closed]
- Ordering users of a specific role by last name
- How to programmatically add a user to a role?
- Restrict Author to pick from media library, but not upload media
- Can i copy administrator role to another user?
- how to add custom user capabilities using add_user_meta or something else?
- Assign Subscriber capabilities to a custom user role
- Problems with localization
- How to change role of all users with a specific role to another role?
- Localization works but still get “This plugin is not properly prepared for localization” msg in directory
- Allow user to Publish, but not Edit or Delete
- Roles at registration (classipress)
- How to allow registered users to change their user role through frontend?
- Remove Ability for Administrators to Delete Administrators
- Order users by custom user meta
- how to change user roles for users who doesn’t have any. (about 8000 users)
- List total number of users that are authors
- Best location for theme translation files
- Email notification for editors only
- Shold I manually add ‘cap’ to admin role ?
- `wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin
- Custom Post Type’s Capabilities map_meta_cap issues
- I need to assign a role to visitors/guests
- Contributors missing from author dropdown
- How to make an author archive only for certain user role and show related CPT
- Getting a user role from the user login name
- Localization / textdomain is slow and chaotic
- Allow users to publish child pages of the pages they have access to edit
- Can’t translate the post meta data (Date) in another language
- How to load theme textdomain from plugin?
- Auto Delete Users (auto_delete_users)
- New Roles and Capabilities in WordPress
- Change language of comments template
- Why is wp-login redirecting to the home page when I use this function?
- Is there a way to set the user Role based on email domain
- Allow contributor to view own scheduled post
- Editor and contributor roles not correct after adding function
- Adding multiple user roles dynamically
- Can’t we use strings defined as PHP constants if we want to translate them in a plugin?
- get_the_date() for translating date format
- WordPress Super Admin
- pre_get_posts Remove posts based on meta value with ‘post__not_in’
- How to add author role as a custom field to custom post type in wordpress?
- How to prevent users with “edit_others_posts” capability from editing admin posts