AJAX request of plugin loads wrong textdomain on front
-
I have found an interesting issue with this otherwise lovely plugin.
Settings: Front: Danish, Admin: English
Locale in WP-config is DanishI’m making an AJAX-call in a plugin from the frontpage. Since admin-ajax.php ( all AJAX requests ) run in the admin scope of the WordPress installation, the English textdomain is loaded instead of the Danish one.
If fixed this problem for now by adding this function to the locale filter. Source is a variable I pass with the AJAX request:
function locale_ajax_check($locale) { if (is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX && isset($_REQUEST["source"]) && $_REQUEST["source"] == 'front') { return get_option('wp_language_locale_front'); } return $locale; }
Maybe there is a better way as future update though.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘AJAX request of plugin loads wrong textdomain on front’ is closed to new replies.