• Resolved cbcg

    (@cbcg)


    If you disable Polylang while this plugin is active, it crashes WordPress badly enough that you can’t even get in to disable it.
    (We have a client who wanted a bilingual site, but now won’t have the translations done in time to go live, so will add them later.)

    I’ve fixed it locally by adding the following checks.
    admin/String_Registration.php
    At the start of the function register_strings_from_array_recursive()

    if(!function_exists('pll_register_string')) {
    	return;
    }

    inc/Helpers.php
    At the start of the function load_string_translations_textdomain()

    if(!function_exists('pll__')) {
    	return;
    }

    It’s also nicer if it can strip out the curly braces if it’s not active.

    inc/Helpers.php
    Remove from the start of the function translate_translation_strings_recursive()

    if(!function_exists('pll__'))
    	return $text_or_array;

    and replace with
    $use_pll = function_exists('pll__');

    then in the foreach loop, replace
    $text_or_array = str_replace('{'.$string.'}', pll__($string), $text_or_array);

    with

    $replace = $string;
    if($use_pll) {
    	$replace = pll__($replace);
    }
    $text_or_array = str_replace('{'.$string.'}', $replace, $text_or_array);

    Thank for the plugin. Would it be possible to add something like the above?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Disabling Polylang, with this active, kills WordPress’ is closed to new replies.