• Resolved Tim

    (@timwakeling-1)


    Hi – great plugin!

    I realise I’ve made a rod for my own back here, but I am using your plugin along with WP Page Widget to allow different widgets on different pages, and WPML.

    I noticed that a particular widget on an English page on my site is showing the English widget title but the content from the same widget on the equivalent Welsh version of the page. A little troubleshooting revealed that the switch happened during the function wpml_widget_text() which starts on line 187 of black-studio-tinymce-widget/includes/class-compatibility-plugins.php.

    Because WP Page Widget means I’m putting separate widgets on each page (and each translation of each page) anyway, I don’t actually need widgets to translate themselves. In fact that appears to be causing this issue as the widget seems to be “translating” itself back into the other language. Am I making sense?

    Anyway I’ve worked around this for the site in question by commenting out the wpml_widget_text function in your code, and thereby disabling the translation of widgets, but I thought you might want to incorporate a fix into your code too?

    Plugin compatibility issues can be a nightmare, can’t they? I really appreciate all your efforts. ??

    Tim

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Marco Chiesi

    (@marcochiesi)

    Hello Tim,
    thank you very much for your detailed report and for debugging the issue (much appreciated). I will try to add a fix in the future releases.
    In the meantime I would suggest you to disable the WPML translation of widgets using hooks instead of commenting the source code, as the plugin provides hooks to do so.

    Please see our FAQ at section “How to customize widget contents (using hooks)” for further details.

    In particular the following snippet should do the trick in your case:

    
    add_action( 'init', 'my_remove_bstw_widget_text_filters' );
    function my_remove_bstw_widget_text_filters() {
        if ( function_exists( 'bstw' ) ) {
            remove_filter( 'widget_text', array( bstw()->compatibility()->plugins(), 'wpml_widget_text' ), 2 );
        }
    }
    
    Thread Starter Tim

    (@timwakeling-1)

    Thank you very much! ??

    Plugin Author Marco Chiesi

    (@marcochiesi)

    Hi @timwakeling-1,
    Thanks for your patience. The latest release 2.5.0 comes with a fix for this issue. Widgets added through WP Page Widgets will be no longer sent to WPML String Translations plugin. Please note that you may need to manually remove existing translation to cleanup the DB.

    Thread Starter Tim

    (@timwakeling-1)

    Thank you! ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Widget translation issue with WPML and WP Page Widget’ is closed to new replies.