Skip Navigation

Resolved

Reported for: WPML Multilingual CMS 4.5.7

Resolved in: 4.5.8

Overview of the issue

With the newest WordPress version, 6.0, posts may end up with duplicated taxonomy terms.

Workaround

This issue should be solved with WPML 4.5.8.

Please, make a full back up of your site before proceeding.

  1. Open the wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering/class-wpml-term-adjust-id.php file.
  2. Look for line 59.
  3. Change:
    		if (
    			$adjust_id_url_filter_off
    			|| ! $this->sitepress->get_setting( 'auto_adjust_ids' )
    			|| $this->is_ajax_add_term_translation()
    			|| $this->debug_backtrace->are_functions_in_call_stack(
    				[
    					'get_category_parents',
    					'get_permalink',
    					'wp_update_post',
    					'wp_update_term',
    
  4. To:
    		if (
    			$adjust_id_url_filter_off
    			|| ! $this->sitepress->get_setting( 'auto_adjust_ids' )
    			|| $this->is_ajax_add_term_translation()
    			|| $this->debug_backtrace->are_functions_in_call_stack(
    				[
    					'get_category_parents',
    					'get_permalink',
    					'wp_update_post',
    					'wp_update_term',
    					[ 'WP_Term_Query', 'populate_terms' ],
    

Note: You may need to go to WPML > Support > Troubleshooting page, select Products and click on the Synchronize posts taxonomies button as in the picture below.

23 Responses to “WordPress 6.0 - Issues with taxonomy terms assigned to posts”

  1. For users of Ultimate Product Catalog this issue causes a maximum of two items to be displayed when selecting any product category, irrespective of the number of items in that category.

    The number of items displayed is limited, rather than duplicated.

    The workaround fixes the problem.

    • We are glad to know this workaround helped in your case and thank you for letting us know. Our developers are working on this situation and we hope to have a new release soon, I can’t provide an ETA but we will keep update it here.

    • Hey there,
      If this does not help, please open a ticket in our support forum. In that way, one of our specialists would be able to investigate your case and find a solution.
      Thank you for your help.

  2. Tested it out on two different websites, the workaround seems to be working fine. Taxonomy terms don’t get randomly assigned multiple times to single posts anymore.

  3. Will there be more of a knowledge base type article on this – e.g. in which ways these problems minifest themselves?
    Just wondering since I have a pretty plain vanilla install, but my categories displayed for posts are randomly on each reload going from disappearing being shown to some of them being shown up to x5 times.

    I’m a bit puzzled if this issue is covered by above – would imagine if its more widespread there would have been a ton of feedback from the 1 mio userbase 🙂
    Anyway have also logged ticket with support of course

    • We are not planning to create some other documentation regarding this situation. As it is a bug introduced with latest WordPress and WPML update, it should be solved in our next release.
      In the meantime, we encourage you to use the workaround here presented.
      Thank you for your understanding.

  4. Good afternoon!
    For me, ( the problem after the upgrade to wp 6.0 ) is that the taxonomies in the default language are ok, but in the English translation they are duplicates both on the product page and in the administration.
    I tried this solution and after I changed that code the difference was that in the English translation the duplicate taxonomies (products meta) were shown double but one in the original language and the other in the translation.
    In the administration, there are also double taxonomies in translation, one copy in the default language and the other in English.
    I made an update to 4.5.8 but that didn’t help either. The same problem continues.
    Only now that I have made this solution, there are duplicates in the same language in public, and the administration is still mixed. And only on variable items but not on all.

  5. This appears to be causing WooCommerce Variable products to be switched to Simple products — which can break a lot of things.

    Manually setting the products back to Variable fixes it briefly but they eventually switch back.

    Applying the fix provided, flushing the site’s cache, and flushing rewrite rules resolve this.

  6. Thanks, worked for me!
    I had issues before in Woocommerce:
    • Variable Products were displayed as simple products in the shop. Usually, you can click on the products to “configure options”, but in this case it was “add to the basket”. This did not make sense as normally you would need to select your product properties (like size).
    • Using the export function from Woocommerce to generate csv file (for mass editing), the file was corrupted in several places, like “simple product” instead of “variable”, missing / wrong delivery times.
    Let us hope that there will be a stable fix.