Skip Navigation

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 9 replies, has 2 voices.

Last updated by sebastiaanV-11 1 year, 10 months ago.

Assisted by: Bigul.

Author Posts
October 21, 2022 at 6:38 am #12284465

sebastiaanV-11

We have discussed this already in another ticket but should be relevant to this one:

The below products show the in the URL the Dutch category, though it should be in English. It seems only these have the issue, and it's only the category. I believe these are the same products that show as "Published — Pending review" in the translations queue. So it's related to each other.

hidden link

hidden link

hidden link

hidden link

I believe this PHP warning is also related to the issue:

[19-Oct-2022 14:25:18 UTC] PHP Warning: Attempt to read property "element_id" on null in /home/mymoissanite/public_html/staging/wp-content/plugins/sitepress-multilingual-cms/classes/API/REST/jobs/class-wpml-tm-rest-jobs-view-model.php on line 171
October 21, 2022 at 10:14 am #12286203

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

This looks like a conflict with the Rank Math SEO plugin. On my local copy, it works fine when the Rank Math SEO plugin is inactive. So I have shared the details with my team and waiting for their feedback. Please wait.

--
Thanks!

Bigul

October 23, 2022 at 2:15 pm #12295441

sebastiaanV-11

Yes, that works. Thanks. Will wait further guidance.

October 24, 2022 at 11:48 am #12299929

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the confirmation. The issue is escalated to our second-tier team for further debugging. We will get back to you as early as possible. Please wait.

--
Thanks!

Bigul

November 3, 2022 at 10:03 pm #12375085

sebastiaanV-11

Hello. May I please receive an update? This issue prevents us from launching our staging site to live, because of faulty URL's. Thank you.

November 4, 2022 at 4:57 pm #12384495

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Our second-tier team is still working on this. We will get back to you as early as possible. Please wait.

--
Thanks!

Bigul

November 7, 2022 at 9:16 am #12396701

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

We have a workaround for this bug. Please try the following steps after a full site backup{mandatory} and make sure the issue is existing or not.

1) Go to *wp-content/plugins/seo-by-rank-math/includes* folder
2) Open *class-common.php* file for edit
3) Scroll down to line 236
4) Make the following changes in the code and save it

From

private function get_primary_term( $taxonomy, $post_id ) {
		$primary = Helper::get_post_meta( "primary_{$taxonomy}", $post_id );
		if ( ! $primary ) {
			return false;
		}

		$primary = get_term( $primary, $taxonomy );
		return is_wp_error( $primary ) || empty( $primary ) ? false : $primary;
}

To

private function get_primary_term( $taxonomy, $post_id ) {
	$primary = Helper::get_post_meta( "primary_{$taxonomy}", $post_id );
        $test_post = apply_filters( 'wpml_post_language_details', NULL, $post_id );
        $test_meta_id = apply_filters( 'wpml_element_language_details', null, array('element_id' => $primary, 'element_type' => $taxonomy ) );

        if ( isset($test_post["language_code"]) && ($primary != "") && $test_post["language_code"] != $test_meta_id->language_code ) {
            $primary = apply_filters( 'wpml_object_id', $primary, $taxonomy, TRUE  );
        }
	
        if ( ! $primary ) {
		return false;
	}

	$primary = get_term( $primary, $taxonomy );
	return is_wp_error( $primary ) || empty( $primary ) ? false : $primary;
}

5) Visit Settings>>Permalinks & resave the settings
6) Clear all types of caches

--
Thanks!

Bigul

November 7, 2022 at 11:03 am #12398243

sebastiaanV-11

Thank you. This indeed fixed the issue. I appreciate it! What should I do when there's a rankmath update?

November 7, 2022 at 12:42 pm #12399819

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the feedback. Happy to know you are getting the expected results now. We are not able to reproduce the issue exactly in a fresh installation. So as of now it is an exception and hopes it will be fixed in the future version of the Rank Math plugin. May you have to append this fix code to the latest version of the plugin also.

--
Thanks!

Bigul

November 10, 2022 at 6:15 am #12425959

sebastiaanV-11

Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.