WPML

Overview of the Issue

When creating a menu and assigning it to a location in AppearanceMenu, refreshing the page unchecks the location checkbox. However, the menu still displays correctly on the front-end.

This issue occurs when term IDs are not equal to term taxonomy IDs, which can happen on sites running WordPress since version 4.1 or older as explained here (opens in a new tab).

Workaround

This issue is fixed in WPML 4.6.4. Updating solves it on your site, so you only need this workaround if you can’t update yet.

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

  1. Open …/sitepress-multilingual-cms/inc/taxonomy-term-translation/wpml-term-translation.class.php.
  2. Look for line 118.
  3. Change:
    PHP
    private function maybe_warm_term_id_cache() {
    
    	if ( ! isset( $this->ttids ) || ! isset( $this->term_ids ) ) {
    
    		$data           = $this->wpdb->get_results( "	SELECT wpml_translations.element_id, tax.term_id, tax.taxonomy
    												 " . $this->get_element_join() . "
    												 JOIN {$this->wpdb->terms} terms
    												  ON terms.term_id = tax.term_id
    												 WHERE tax.term_id != tax.term_taxonomy_id",
    		                                      ARRAY_A );
    		$this->term_ids = array();
    		$this->ttids    = array();
    		foreach ( $data as $row ) {
    			$this->ttids[ $row['term_id'] ]                     = isset( $this->ttids[ $row['term_id'] ] )
    				? $this->ttids[ $row['term_id'] ] : array();
    			$this->ttids[ $row['term_id'] ][ $row['taxonomy'] ] = $row['element_id'];
    			$this->term_ids[ $row['element_id'] ]               = $row['term_id'];
    		}
    	}
    }
    To:
    PHP
    private function maybe_warm_term_id_cache() {
    
    	if ( ! isset( $this->ttids ) || ! isset( $this->term_ids ) ) {
    
    		$data           = $this->wpdb->get_results( "	SELECT wpml_translations.element_id, tax.term_id, tax.taxonomy
    												 " . $this->get_element_join() . "
    												 JOIN {$this->wpdb->terms} terms
    												  ON terms.term_id = tax.term_id
    												 WHERE tax.term_id != tax.term_taxonomy_id",
    		                                      ARRAY_A );
    		$this->term_ids = array();
    		$this->ttids    = array();
    		foreach ( $data as $row ) {
    			$this->ttids[ $row['term_id'] ]                     = isset( $this->ttids[ $row['term_id'] ] )
    				? absint($this->ttids[ $row['term_id'] ]) : array();
    			$this->ttids[ $row['term_id'] ][ $row['taxonomy'] ] = absint($row['element_id']);
    			$this->term_ids[ $row['element_id'] ]               = absint($row['term_id']);
    		}
    	}
    }

All known issues

Still Seeing This Issue?

If updating doesn’t fix it, ask a support question and we’ll look into it with you.