Since WP 4.6 load_theme_textdomain()
(and consequently load_child_theme_textdomain()
) will give priority to .mo files downloaded from WP’s online translation platform (translate.wordpress.org). Due to some new code (here, on line 769) these functions will completely ignore your local .mo files if the textdomain is found in the general languages/ directory.
You can, however, use the more basic load_textdomain()
function to directly load your .mo file and override strings from the original domain, like this:
$domain = 'textdomain-to-override';
$path = get_stylesheet_directory() . '/languages/'; // adjust to the location of your .mo file
$locale = apply_filters( 'theme_locale', get_locale(), $domain );
load_textdomain( $domain, $path . $locale . '.mo' );
Related Posts:
- WooCommerce: change display order of product short description and price [closed]
- Is a text-domain necessary for a child theme
- switch_to_blog(): Load textdomain
- A good way to add a different background image for each page?
- How to update WordPress core or themes and still have my child theme hooks work
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- Removing parent theme action on pluggable function not working
- WordPress filter load_textdomain_mofile not working inside a child theme’s functions.php but works form inside a plugin
- Remove action in a parent theme from the child theme
- Remove action within a class in a parent theme’s includes folder from the child theme
- remove_action() hook not working
- Removing action from template class
- Where can I find a list of WordPress hooks?
- Override parent theme translation on child theme
- Whats worth using add_action when we can simply use add_filter?
- Is it ok to use a function to output the text domain name in a wordpress theme
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Hook on trash post
- Adding onload to body
- What is the earliest possible hook for safely using `is_front_page`?
- Send data to 3rd party api with wp_remote_post on wp_login
- How to customize the WP admin default help contents
- Hide gutenberg option blocks
- Difference between hooks Plugin_loaded and admin_int?
- admin_post hook not called
- deactivated_plugin hook: get the name of the plugin
- Is there a hook for user activation (after they click the email confirm)?
- Setcookie works on admin but not front end
- How to debug removal of rewrite rule flushing?
- function ‘wp_enable_block_templates’ not found
- Bulk action hook for admin pages which uses WP_List_Table
- How to hook into user registration process Before user registers
- WP Admin Bar frontend issue with dashicon deregister
- What is the best filter where to use register_block_type?
- I don’t understand why I shoud use lostpassword_url hook?
- How to get session token of current user in wp_login hook?
- wp_login Action hook with conditional tag
- Hook any php file into the wordpress api
- WP CLI Get all Enqueued Scripts and Styles
- Delay an action until current action is completed
- How to properly setup an activation hook
- How to remove scripts/style added to customize_controls_enqueue_scripts hook by current active theme
- Help to change the text for new website notification (wpmu_welcome_notification)
- How to remove query string from current page URL?
- Plugins rewrite rules the right way
- Strange behaviour with add_{$meta_type}_metadata | add_post_metadata filter
- Plugin init hook
- Add nofollow to custom widget posts
- Change Password Confirmed Email Text
- Add other social networks to TwentyNineteen_SVG_Icons class in child theme?
- How to check post type when using sanitize_title hook?
- Register form: add custom field BEFORE default fields
- Custom Front End Registration – How Does the Key work in the Password Set Request?
- How to change the default mail when admin approuved an user?
- Lock user information once fields have been filled in
- How do I prevent term from being created on create_term hook?
- save_post hook to add terms getting deleted when using bulk edit
- Hook function prints output twice
- Hook priority in admin with custom plugin
- How to solve a translation function issue with no arguments and missing a text-domain?
- Add Different Actions To Different Page’s wp_footer
- Add back in child theme what the parent theme removed with remove_action
- Getting the post ID in parse_query
- Remove genesis_404 hook from genesis_loop [closed]
- What hooks do I need to hook into to capture ever wp_user creation/change?
- Is there a before_save_post hook or something similar
- Neccessary to call add_submenu_page and add_menu_page from admin_menu hook?
- Adding custom Bulk Actions
- Print results of a WP_Query to wp-admin/upload.php within ‘delete_attachment’ hook?
- Is there a way to Insert a post to post list?
- How to call do_action() to pass arguments to hooked functions that take different number of args?
- WP hook to add custom content after the_title()
- Is it likely that do_action will have unexpected results?
- How to export category name and category link in wordpress json
- call_user_func_array() expects parameter 1 to be a valid callback, class ‘WC_Rapyd’ does not have a method ‘install’
- Error later wordpress 5.3.2 update. Please help
- Plugin function in child theme
- How to abort a save operation with a WordPress hook?
- wp_get_current_user Not working
- is_page not triggering
- admin_post_(action) hook create console log error
- Check if front page within function passed to action
- Hook after creating a post and retrieve infos from this post immediatly
- Display custom debug info inside page and not before head
- $new_pass always returns null – password_reset hook
- How to resolve 500 error in post listing page?
- Object oriented programming, add_action in constructor not firing
- Get new (not old) post inside transition_post_status hook
- How to Show Different Information to your authors/contributers
- Cannot override hooks.php
- Remove “enqueued” script from array
- Function is Missing an Action Hook
- How to access variables in the function where apply_filters() is called?
- How to change Akismet commenter privacy notice?
- How To Apply Different Styles To All Blocks Based on Post Meta Value?
- PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered
- getSaveContent.extraProps hook for core/post-title doesn’t add new attributes on to the frontend
- How can I get the ID before after_setup_theme?
- Hook on opening a media/document
- Why does before_delete_post run when opening a post in the backend?