WPML
ステータス
解決済み
報告対象
WPML Multilingual CMS 4.6.3
解決されたバージョン
WPML 4.6.4
トピックタグ
Bug

問題の概要

外観メニューでメニューを作成し、場所に割り当てた後、ページを更新すると、場所のチェックボックスのチェックが外れます。ただし、フロントエンドではメニューは引き続き正しく表示されます。

この問題は、タームIDがタームタクソノミーIDと等しくない場合に発生します。これは、こちらで説明されているように、バージョン4.1以前からWordPressを実行しているサイトで発生する可能性があります。

回避策

続行する前に、必ずサイトの完全なバックアップを作成してください。


  1. …/sitepress-multilingual-cms/inc/taxonomy-term-translation/wpml-term-translation.class.phpを開きます。

  2. 118行目を探します。

  3. 変更前:
    	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'];
    			}
    		}
    	}
    変更後:
    	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']);
    			}
    		}
    	}

すべての既知の問題 →