WPML
ステータス
未解決
関連するプラグイン/テーマ
The Events Calendar
トピックタグ
Compatibility

問題の概要

The Events Calendarプラグインとその「Integrate events in main blog loop」機能を使用している場合、URLに何らかのパラメーター(example.com?foo=bar)が追加されると、ルートページが空白で表示される問題が発生します。この問題は特に、WPMLの「デフォルト言語にディレクトリを使用する」設定も有効化されている場合に発生します。

回避策

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


  • …/wp-content/plugins/the-events-calendar/src/Tribe/Query.phpファイルを開きます。

  • 577行目を探します。

  • 置き換え前:
    	protected static function add_post_type_to_query( WP_Query $query, string ...$post_types ): void {
    		
    		$query_post_types = self::get_query_post_types( $query );
    
    		$updated_post_types = array_unique( array_merge( $post_types, $query_post_types ) );
    
    		$query->set( 'post_type', $updated_post_types );
    		$query->query['post_type'] = $updated_post_types;
    	}

  • 置き換え後:
    	protected static function add_post_type_to_query( WP_Query $query, string ...$post_types ): void {
    		
    		$query_post_types = self::get_query_post_types( $query );
    
    		// WPML Workaround for compsupp-7426
    		if ( class_exists('Sitepress') ) {
    			$is_root_enabled = apply_filters( 'wpml_sub_setting', false, 'urls', 'directory_for_default_language' );
    			
    			if ( $is_root_enabled && is_home() ) {
    				return;
    			}
    		}
    
    		$updated_post_types = array_unique( array_merge( $post_types, $query_post_types ) );
    
    		$query->set( 'post_type', $updated_post_types );
    		$query->query['post_type'] = $updated_post_types;
    	}

すべての既知の問題 →