WPML
Status
Resolved
Resolved in
4.5.3
Related plugin/theme
Divi

Overview of the issue

Divi theme allows you to add conditions in the advanced settings section. This lets you decide what content to display according to criteria like browser type, pages, user roles, etc.

Adding a condition to display content according to category works fine for the default language, but is not applied to the translation.

Workaround

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


  1. Open the file /themes/Divi/includes/builder/module/field/display-conditions/CategoryPage.php

  2. Look for line 46.

  3. Replace:
    		$categories_ids               = array_map(
    			function( $item ) {
    				return $item['value'];
    			},
    			$categories_raw
    		);


  4. With:
    		$categories_ids               = array_map(
    			function ($item) {
    				$WPML_category_translated = apply_filters('wpml_object_id', $item['value'], 'category', TRUE);
    				return $WPML_category_translated;
    			},
    			$categories_raw
    		);

All known issues →