Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
After updating to WPML 4.7.4 and String Translation 3.3.3, issues arose with post categories not being recognized correctly on the front end when using Elementor. Disabling String Translation temporarily resolved the issue, indicating a compatibility problem between the updated versions of WPML, String Translation, and Elementor.
Solution:
We identified that the issue stems from Elementor using

term_taxonomy_id

instead of

term_id

, which our code did not anticipate, leading to all results being shown without filtering by a taxonomy term. A fix for this issue will be included in the upcoming WPML 4.7.5 release. Meanwhile, we provided a workaround involving a code modification in

/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php

. This modification should be tested on a staging site after taking a full backup. If this solution does not resolve your issue or seems outdated, please check for related known issues at https://wpml.org/known-issues/, verify you have the latest versions of themes and plugins, and if necessary, open a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 32 replies, has 1 voice.

Last updated by Andreas W. 3 weeks, 5 days ago.

Assisted by: Andreas W..

Author Posts
May 22, 2025 at 5:58 pm #17063281

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

The problem that will be fixed is:

Elementor is using term_taxonomy_id instead of term_id
Our code expects term_id
When the term_id is different than term_taxonomy_id, this returns NULL for the term translation and hence removed from the query.
Because of that all results are shown without filtering by a taxonomy term

This happens on any loop widget.

I can offer you a workaround, but I have currently not tested it, which is why I ask you to run this test on a staging site and make sure to first take a backup of the site and database:

Inside:
/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php

Search the function convert() and replace the whole function with:

ublic static function convert( $ids, $elementType = null, $fallbackToOriginal = false, $targetLang = null ) {
		$isId = function( $id ) {
			return is_numeric( $id ) && ! is_float( $id );
		};

		$getElementType = self::selectGetElementType( $elementType );

		/**
		 * @param int|string|mixed $id
		 *
		 * @return int|string|null|mixed
		 */
		$convertId = function( $id ) use ( $isId, $getElementType, $fallbackToOriginal, $targetLang ) {
			/** @var \SitePress $sitepress */
			global $sitepress;

			if ( ! $isId( $id ) ) {
				return $id;
			}
			$term = get_term($id);
			if ($term) {


			$convertedId = $sitepress->get_object_id( $id, $getElementType( (int) $id ), $fallbackToOriginal, $targetLang );

			if ( $convertedId ) {
				return is_string( $id ) ? (string) $convertedId : $convertedId;
			}

			return null;
		} else {
				$term = get_term_by('term_taxonomy_id', $id);
				$convertedId = $sitepress->get_object_id( $term->term_id, $getElementType( (int) $term->term_id ), $fallbackToOriginal, $targetLang );

				if ( $convertedId ) {
					$convertedterm = get_term($convertedId, $getElementType( (int) $convertedId ));
					if ($convertedterm) {
						$convertedId = $convertedterm->term_taxonomy_id;
					}
					return is_string( $id ) ? (string) $convertedId : $convertedId;
				}

				return null;
			}

		};

		try {
			return $isId( $ids )
				? $convertId( $ids )
				: Obj::over( self::selectLens( $ids ), $convertId, $ids );
		} catch ( \Exception $e ) {
			return $ids;
		}
	}
May 27, 2025 at 2:15 pm #17079169

azimd

Thanks a lot for your help. After taking the new update WPML 4.7.5, the site is working fine .. Appreciate your help

May 28, 2025 at 1:30 am #17080964

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Thank you for letting us know and I am very glad to hear that the issue is solved!