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
- Is there a way to send HTML formatted emails with WordPress’ wp_mail() function?
- How to get WordPress’ hooks/actions run sequence?
- Where can I find a list of WordPress hooks?
- Is there a save_post hook for custom post types?
- Where is the right place to register/enqueue scripts & styles
- How to know what functions are hooked to an action/filter?
- How to hook update_post_meta and delete_post_meta?
- Are there any hooks that alter the 404 logic?
- Is there a hook that runs after a user logs in?
- Difference between do_action and add_action
- What is a Theme textdomain?
- WP Cron Doesn’t Execute When Time Elapses
- Why do some hooks not work inside class context?
- Difference between after_setup_theme and init action hooks?
- Override parent theme translation on child theme
- get $post in init filter or action?
- Use wp init hook to call other hooks?
- How many times can I hook into the same action?
- How do I implement the WordPress Iris picker into my plugin on the front-end?
- How to intercept a 404 error
- Move excerpt meta box to above content editor
- Action hook for custom tax edit
- Trigger custom action when setting button pressed
- What is “all” in isset($wp_filter[‘all’])
- Whats worth using add_action when we can simply use add_filter?
- Is there a limit to hook priority?
- Please explain how these hooks work
- Is it ok to use a function to output the text domain name in a wordpress theme
- Add_action to wp_head via functions.php
- Hook after image is uploaded and image sizes generated
- Is there a hook before the user is authenticated?
- Do Child-Themes automatically load the Translation from the Parent-Theme?
- Hook that fires when admin setting is saved
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- What is the difference between update_post_meta and update_postmeta hooks?
- Hook ‘wp_enqueue_scripts’ priority has no effect
- Hook on trash post
- Hook *after* user password change?
- How to debug failed load_theme_textdomain()?
- Auto-retrieve YouTube Image for Thumbnail?
- Which hook if user profile information is updated?
- How to remove action hook done in a plugin from functions.php in my theme?
- Hooks for trashing, deleting, saving, restoring custom post type
- Is there a WordPress core & plugins update action hook?
- Hook into WordPress update?
- why is translation not working on theme?
- trigger save_post event programmatically
- Implementing advanced add_* function wrappers
- Adding onload to body
- My add_action (wp_footer, ‘method’) is not calling?
- Do WordPress Core Filenames Work as Hooks?
- What is the earliest possible hook for safely using `is_front_page`?
- How to call a REST endpoint when a post is published?
- __NAMESPACE__ with register_activation_hook
- Can I hook inside another hook?
- Adding function directly vs using hook in function.php
- Are hooks called synchronously?
- How to check if which hook triggered the call to a function?
- How can I send to multiple Contact Form 7 recipients based on form input? [closed]
- Hook into wp_head(); in a plugin
- Send data to 3rd party api with wp_remote_post on wp_login
- is it possible to get the hook name in add_action?
- Hook for URL Request
- How do I flush the rules after saving settings using the Settings API?
- Run javascript code after wp_login hook?
- Does anyone have a visual breakdown of core hooks and when they are fired?
- How to customize the WP admin default help contents
- What is the action hook for save media-form on gallery tab?
- How to load translation in JavaScript?
- What hook is executed just after wp_query has been executed?
- Hide gutenberg option blocks
- Overwrite textdomain of plugins by default – Lost Translation
- The ‘user_has_cap’ hook seems to take two page loads to trigger
- Implementing DNS Prefetching with WordPress
- How and where can we request new WordPress hooks to be added?
- Disable block from editor based on post type
- WordPress Admin Tooltip hooks
- Difference between hooks Plugin_loaded and admin_int?
- Wp_update_post: Infinite loop even with remove_action solution, OOP
- Hook/notify when any option or setting is added or updated
- Is it possible to save/modify a post without calling the “save_post” action hook?
- Which hooks is this? add_action(‘wp’,
- Redirect logged in users if they are on a specific page
- Make W3 Total Cache “Empty All Caches” function purge varnish [closed]
- load_plugin_textdomain in `plugins_loaded` or `init`?
- Use $query->set multiple times with pre_get_posts?
- admin_post hook not called
- Check if action hook exists before adding actions to it