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:
- Translate a plugin using .po .mo files
- How to make plugin required in a wp theme without using php conditional statements when calling an individual function from that plugin?
- Can I leave off plugin textdomain for terms used in core?
- Can I make plugins required?
- Override plugin localization
- Automatically install wordpress plugin at theme activation
- When coding a WordPress theme, where does the theme (i.e. the presentation) end and the plugin (i.e. the functionality) begin?
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- WordPress tips for speed and performance [closed]
- How to access options of Redux framework in front end
- Update Multiple Post Meta for the Same Post In One call?
- Integrating plugins in themes
- Internationalization and the plugin description
- How to hide fields from my user profiles
- How can I translate the name of my Plugin for other languages?
- How to make my plugin theme-independent?
- How to load a new template page according to a particular URL?
- Code in theme functions.php faster than with a plugin?
- How do I future proof my older WordPress theme?
- register_theme_directory somehow “fails” when folder is outside of WP-Folder
- Display future posts?
- Having separate plugins and themes folder for multi-site setup
- What is the way to ship read-me strings like plugin-strings for internationalization?
- gallery option is not available in media upload box in costum theme option page
- Why are some of my thumbnails not being generated?
- Override plugin text domain in child theme
- Built in audio player?
- How to retrieve custom meta term of category taxonomy from WP Rest API?
- Making my plugin translation ready. Poedit not working
- Network: retrieve a list of latest posts
- Why is the generated POT file from WordPress.org not adding my plugin description to the POT file?
- WooCommerce get_price returning wrong price when used via ajax
- Open Post Thumbnail in New Child Theme File in WordPress
- How to use get_theme_mod in gutenberg editor wordpress?
- How to Display a Plugin function (content) on frontpage using index.php
- Two text domains in one plugin
- How to make a slideshow shortcode based on the WordPress gallery shortcode? [closed]
- All of my custom posttypes are 404’ing
- how to add a button next to the wordpress view button?
- Is it possible to use multiple post_name, post_title and post_content?
- Classified ad website : which solutions to use? [closed]
- What are the specifics of WordPress development I need to know? [closed]
- How to create a code editor for my plugin .?
- Finding the URL to be used to check if plugin is installed with a theme
- Js file is not adding using this code in functions.php
- 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 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
- 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]
- How to make content as required in custom post type?
- What are Seeds? [closed]
- Best approach to change mobile background image and adding its class
- Frontend Enqueued Files in the Backend
- Automatically install bundled plugins during theme activation?
- Gutenberg Blocks and Elementor