Yes, sort of. Any localized plugin such as WP-Members runs off of the “locale” that WordPress is set to. This value can be filtered for WP as a whole using the locale
filter. But it can also be filtered for plugins using plugin_locale
See: https://developer.wordpress.org/reference/hooks/plugin_locale/
To use plugin_locale
specific to the text domain for the plugin* (which in this case is ‘wp-members’)
add_filter( 'plugin_locale', 'my_plugin_locale_filter', 10, 2 );
function my_plugin_locale_filter( $locale, $domain ) {
// If the text domain is 'wp-members'
if ( 'wp-members' == $domain ) {
/*
* This logic adapted from the method you referenced at
* http://beta.beantin.se/wordpress-setting-language-individual-pages/
* Note that the function get_top_parent_page_id() from that example
* is used here, and the logic is not adapted to your specific
* question (i.e. I assume the default $postLanguage value is
* Norwegian in your case and you are switching it to English) so
* change this to match what you are doing with the other elements
* being used from that process.
*/
$postLanguage = "en-GB";
if (is_page()) {
$svPageID = get_top_parent_page_id(); // ID of parent page
if ($svPageID == "565") { // ID of the "på svenska" page
$postLanguage = "sv";
}
$locale = $postLanguage;
}
}
// Always return the value being filtered.
return $locale;
}
*The text domain for any plugin should be noted in the header of the plugin’s main file. For example, if you open wp-members.php and look at the plugin header, you will find this listed under the heading “Text Domain:”.