Display Issues with Localized WordPress (Czech, Slovak, German, French)
Problem
WOOT (WooCommerce Products Tables) not displaying products correctly on sites using certain language localizations. The table appears empty or returns JSON parsing errors in the browser console.
Affected languages:
- Czech (cs_CZ)
- Slovak (sk_SK)
- German (de_DE)
- French (fr_FR)
- Other languages that use typographic quotes
Root Cause
WordPress automatically converts standard ASCII quotes (") to localized typographic quotes (e.g., Czech „quotes” or German „Anführungszeichen”) through the wptexturize() function. This breaks JSON parsing because JSON requires standard ASCII double quotes.
Example of the problem:
// Valid JSON (works):
{"name": "Product"}
// Broken JSON (Czech localization):
{„name": „Product"}
When WOOT returns product data as JSON, WordPress converts the quotes, making the JSON invalid and causing the JavaScript parser to fail.
Solution
Add this code to your theme’s functions.php file to disable quote conversion for problematic locales:
/**
* Fix: Disable typographic quote conversion for AJAX requests
* Resolves WOOT JSON parsing issues in Czech, Slovak, German, French locales
*/
add_action('init', function () {
$locale = get_locale();
$problematic_locales = ['cs_CZ', 'sk_SK', 'de_DE', 'fr_FR'];
if (in_array($locale, $problematic_locales)) {
add_filter('run_wptexturize', '__return_false');
}
});
How It Works
- Detects current WordPress locale using
get_locale() - Checks if locale is in the list of problematic languages
- Disables
wptexturize()function that converts quotes - JSON remains valid with standard ASCII quotes
- WOOT can parse product data correctly
Alternative Solution (AJAX Only)
If you want to disable quote conversion only for AJAX requests (not site-wide):
add_action('init', function() {
$locale = get_locale();
$problematic_locales = ['cs_CZ', 'sk_SK', 'de_DE', 'fr_FR'];
if (in_array($locale, $problematic_locales) && wp_doing_ajax()) {
add_filter('run_wptexturize', '__return_false');
}
});
Adding More Languages
If you experience the same issue with other languages, add them to the $problematic_locales array:
$problematic_locales = ['cs_CZ', 'sk_SK', 'de_DE', 'fr_FR', 'pl_PL', 'hu_HU'];
Verification
After adding the code:
- Clear browser cache
- Clear WordPress cache (if using cache plugin)
- Reload the page with WOOT table
- Check browser console (F12) – no JSON errors should appear
- Products should display correctly
Notes
- This fix applies to all plugins that use JSON responses in these locales
- Does not affect regular post/page content
- Safe to use – only disables typographic quote conversion
- Works with all WordPress versions
