/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
lib/compat/wordpress-7.0/preload.php
28 строк
947 B
George Mamadashvili
Post Editor: Use the correct directory for recent preload improvements (#79359)
22 июн 2026, 17:33
Не верифицирован
22 июн 2026, 17:33
0d2498f
Код
Авторство
О чём код?
<?php /** * Preload necessary resources for the editors. * * @param array $paths REST API paths to preload. * @param WP_Block_Editor_Context $context Current block editor context * * @return array Filtered preload paths. */ function gutenberg_block_editor_preload_paths_6_9( $paths, $context ) { if ( 'core/edit-site' === $context->name ) { // Only prefetch for the root. If we preload it for all pages and it's not used // it won't be possible to invalidate. // To do: perhaps purge all preloaded paths when client side navigating. if ( isset( $_GET['p'] ) && '/' !== $_GET['p'] ) { $paths = array_filter( $paths, static function ( $path ) { return '/wp/v2/templates/lookup?slug=front-page' !== $path && '/wp/v2/templates/lookup?slug=home' !== $path; } ); } } return $paths; } add_filter( 'block_editor_rest_api_preload_paths', 'gutenberg_block_editor_preload_paths_6_9', 10, 2 );