Skip Navigation

Resolved

Overview of the issue

When you use Enfold’s cookie pop-up, it opens up every time you switch the language.

Workaround

We’re working with the theme developers to implement a permanent fix for this issue. In the meantime, you can use the following workaround.

  1. Backup your website files and database.
  2. Add this code snippet in the theme’s functions.php file:
    add_filter('avf_cookie_consent_for_md5', function ($cookie_contents){
    	
    	$default_lang = apply_filters( 'wpml_default_language', null );
    	
    	$message = avia_wpml_get_options('cookie_content');
    	$message = do_shortcode( (array) $message[$default_lang] );
    	$buttons = avia_wpml_get_options( 'msg_bar_buttons' ) ? avia_wpml_get_options( 'msg_bar_buttons' ) : [];
    	$cookie_contents = $message;
    	
    	foreach( $buttons as $button ) {
    		$cookie_contents .= $button['msg_bar_button_label'];
    	}
    	
    	return $cookie_contents;
    });
    

2 Responses to “Enfold - Cookie pop-up always opens when switching between languages”