Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created March 31, 2025 13:30
Show Gist options
  • Save andrewlimaza/2cb0d205aed3af317199b74bb4ddbed3 to your computer and use it in GitHub Desktop.
Save andrewlimaza/2cb0d205aed3af317199b74bb4ddbed3 to your computer and use it in GitHub Desktop.
Force "sv" for locale for Paid Memberships Pro "sv_SE" locales
<?php
/**
* Force the locale to be `-sv.mo/.po` if `sv_SE` is detected as the locale.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* This should resolve issues temporarily if you are using Swedish Locale.
**/
function my_pmpro_force_locale_for_swedish( $locale, $plugin ) {
if ( $plugin === 'paid-memberships-pro' && $locale === 'sv_SE' ) {
$locale = 'sv';
}
return $locale;
}
add_filter( 'plugin_locale', 'my_pmpro_force_locale_for_swedish', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment