- Статус
- Открыто
- Связанный плагин/тема
- 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; }