I am using multisite to translate WordPress website and I have the plugin https://wordpress.org/plugins/nmedia-user-file-uploader/
which I want to be accessible from all languages. From all site you should see the same uploaded content and settings.
How can I achieve that?
Currently if I upload in one language I won’t be able to see in another.
2 Answers
The generic way to do it, is by using the pre_option_{option}
https://codex.wordpress.org/Plugin_API/Filter_Reference/pre_option_(option_name) filter to override the “local” settings and use the value being stored in your “main” sub site.
something like
add_filter( 'pre_option_the_plugin_option_name', function () {
// Code assumes that "blog" 1 is the main one in which the relevant settings are stored.
if (get_current_blog_id() != 1) {
return get_blog_option(1, 'the_plugin_option_name');
}
return false;
}
Depending on the complexity of the plugin, it might not be enough and you will need additional overrides, but this type of code should be enough for simple cases.