ナビゲーションをスキップ

Open

Topic Tags: Compatibility

Overview of the issue

If you are using The Events Calendar plugin and its Integrate events in main blog loop feature, you will encounter that the root page appears blank when any parameter is added to the URL (example.com?foo=bar). This issue occurs specifically when WPML’s Use directory for default language setting is also enabled.

Workaround

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

  • Open …/wp-content/plugins/the-events-calendar/src/Tribe/Query.php file.
  • Look for line 577.
  • Replace:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    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;
    }
  • With:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    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;
    }

返信を残す

トピックに関連した内容を心がけ、他の人に敬意を払ってください。この投稿に関連しない問題についてサポートが必要な場合は、サポートフォーラムを使用してチャットを開始するかチケットを提出してください。

これらのタグを使用できます:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>