Skip to content Skip to sidebar

Waiting for author

Topic Tags: Compatibility

Overview of the issue

When using eRecht24 legal texts for WordPress with WPML, legal texts added via the eRecht24 shortcode or Elementor widget might display in the wrong language. This can happen because the language needs to be set in the eRecht24 shortcode or widget settings.
WPML languages are not used here, so you might need to manually edit your translation to select the correct language in the shortcode or widget.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Add the following code to your theme’s functions.php file.
  •  
    // WPML - Workaround for compsupp-8368 use the shortcode_atts_{$shortcode} filter to change 'lang' to the current language or fallback to English
    add_filter( 'shortcode_atts_erecht24', function ( $out, $pairs, $atts, $shortcode ) {
    	if ( ! class_exists( 'SitePress' ) ) {
    		return $out;
    	}
    
    	$current_lang = apply_filters( 'wpml_current_language', null );
    	$out['lang'] = in_array( $current_lang, array( 'de', 'en' ), true ) ? $current_lang : 'en';
    
    	return $out;
    }, 10, 4 );
    

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>