WPML
สถานะ
เปิด
ปลั๊กอิน/ธีมที่เกี่ยวข้อง
The Events Calendar
แท็กหัวข้อ
Compatibility

ภาพรวมของปัญหา

หากคุณกำลังใช้ปลั๊กอิน The Events Calendar และฟีเจอร์ Integrate events in main blog loop คุณจะพบว่าหน้า root แสดงเป็นหน้าว่างเมื่อมีการเพิ่มพารามิเตอร์ใด ๆ ลงใน 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;
    	}

ปัญหาที่ทราบแล้วทั้งหมด →