First of all, I’d strongly recommend against storing translations for a plug-in in your theme. It has no reason to be there, and you’ll loose the translations when you change/update the theme.
The correct place to store translations is wp-content/languages/plugins/
.
This code does that, and targets the domain ‘other_plugin’:
function wpse159536_override_mofile_path( $mofile, $domain ){
if( 'other_plugin' == $domain ){
$mofile = WP_LANG_DIR . '/plugins/' . basename( $mofile );
}
return $mofile;
}
add_filter( 'load_textdomain_mofile', 'wpse159536_override_mofile_path', 10, 2 );
Of course, an even better solution would be to send the translation file to the developer to include in the next release (if this is appropriate).
Related Posts:
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Is there any sort of theme dependency management?
- How do I cleanly override a plugin’s CSS with a child theme?
- Add Plugins to WordPress Theme
- wp_enqueue_scripts not working in custom theme
- What is the correct way for a theme to support plugin UIs?
- How to call “page specific menu items” in template [closed]
- Create WooCommerce Product Category Programmatically
- Seeking clarification on page request life-cycle
- Get info (url) from already enqueued styles
- How do I make my wordpress page more friendly for mobile viewers?
- WordPress Enqueue Script Chaos (jQuery & Foundation.js)
- login to wordpress with Get variables instead of Post
- Should I add sharing buttons using a plugin or directly in my theme files?
- Check javascript file Proper way in functions.php
- Should I use RIPS tool to test my themes and plugins?
- How to Build a Movie Library in WordPress 3.x
- resize only height using wp_get_image_editor
- How can I get full attachment url from wp_get_attachment_metadata?
- Translating plugin inside the theme [closed]
- unzip a folder on specific location and delete the zip file
- Editing Theme to apply Co-Authors Plus
- How to limit WordPress pages during updates?
- Why is the Settings API is not saving my array of options
- Include Max mega menu Plugin into theme
- How to integrate plugin in WordPress theme
- How to include plugin without activation?
- How do you remove plugin edit option?
- Localiztion in javascript
- Override the filter from plugin in child theme
- WordPress logo upload option in theme panel
- Possible to add a language file to a plugin without adding .po/.mo files to plugin directory?
- wordpress theme backend admin only
- how to load the language file in plugin?
- How to get current post user id
- Different UI in WordPress
- Redux Framework has an embedded demo. Click here to activate the sample config file
- Why does my functions.php cause white-screen and media-library issues?
- Display post lists in 2nd paragraph
- wp_get_post_terms is difference obj model than the one in rest api response
- What can be reason for no plugin-strings available under stable section on translate.wordpress.org?
- Best place for short bio,image and button [closed]
- Is there a way to test that readme looks in other language before submitting translation?
- WordPress shows error related to allow_url_fopen
- Force language in translate function
- How to show only next post pagination link using wp_link_pages()
- Can I load the textdomain before a plugin is activated?
- wp_footer hook only working on homepage not in other pages
- How can I position ShareThis buttons manually when using the plug-in? [closed]
- Plugin can not display in my custom theme
- How to use get_template part in the plugin?
- WordPress premium theme development [duplicate]
- How do I combine a theme with a plugin
- how to force tag page layout to use same as search layout?
- How can I show a different theme for admin users? WP 3.8+
- How to show the number of website visitors in my theme
- How to multiply a post to test internal search results?
- Use different single.php file based on condition
- Setting Email locale before retrieving gettext translations
- What form should the $query media query array have for an Elementor page builder function? [closed]
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- Widget for specific category
- How to customize this theme? [closed]
- Don’t load the theme for a page FROM a plugin EDITED
- Extending a theme: build new features as plugin or core modules?
- Remember the Meta Value With Radio Buttons
- Replace woocommerce | (pipe) separator in product variation to , or another character?
- WordPress plugin with its own “site”/theme
- Theme Functions run a function upon activation or preview
- Is there a way to keep youtube videos from displaying on home page, and display only on single posts?
- Janrain/Simple Modal under Redirected Domain
- Warning: Attempt to read property “ID” on null in C:\xampp\htdocs\Nnamdi1\wp-content\plugins\elementor\core\base\document.php on line 250 [closed]
- Seperate plugin and theme files
- Elementor Sidebar not loading when PRO elements plugin is active
- How would I get the new plugin version on this function?
- Unpublished Pages Failing To Appear On Custom Path
- How to get checkbox by default true in metabox?
- How much PHP and MySQL or MariaDB knowledge should I know to start writing WordPress themes and plug-ins and whatever else a beginner can edit?
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- When the user entered an unauthorized url redirect to login page
- Remove action added in plugin class from theme
- Show content from plugin on index
- Get plugin to background of page
- Change localization only for plugin
- Locale changed but plugin still showing default language
- Directory structure for plugin changes
- How to show post attachment image
- Site is setup statically – how to make it content managable?
- How to generate a responsive output from plugin?
- How to work email subscribe in WordPress?
- Loading Canvas & WooCommerce translation file in child theme
- How to create post comparison in wordpress
- Open graph issue on my theme
- Javascript as Jquery Function Call?
- Editing a theme
- How to escape html code?
- manage_{taxonomy}_custom_column not working
- Is website for online game guides doable in WordPress? [closed]
- add_meta_box showing blank screen in my page
- How to create an Info Box on WordPress [closed]