Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
lint
  • Loading branch information
ellatrix committed Oct 21, 2025
commit 0f857498623ef1fef3366c90ca3ace760a22882f
2 changes: 1 addition & 1 deletion src/wp-admin/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static function ( $classes ) {
);
}
}
} else if ( isset( $_GET['p'] ) && '/' !== $_GET['p'] ) {
} elseif ( isset( $_GET['p'] ) && '/' !== $_GET['p'] ) {
// Only prefetch for the root. If we preload it for all pages and it's not
// used it won't be possible to invalidate.
$preload_paths[] = '/wp/v2/templates/lookup?slug=front-page';
Expand Down
6 changes: 3 additions & 3 deletions src/wp-includes/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ function get_block_template( $id, $template_type = 'wp_template' ) {
}
Comment on lines +1361 to +1363
Copy link

@justlevine justlevine Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this nested correctly? We can only get here via the ! empty( $active_templates[ #slug ] ) on L1351 (maybe we want an isset there? )

}

$wp_query_args = array(
$wp_query_args = array(
'post_name__in' => array( $slug ),
'post_type' => $template_type,
'post_status' => array( 'auto-draft', 'draft', 'publish', 'trash' ),
Expand All @@ -1377,8 +1377,8 @@ function get_block_template( $id, $template_type = 'wp_template' ) {
),
),
);
$template_query = new WP_Query( $wp_query_args );
$posts = $template_query->posts;
$template_query = new WP_Query( $wp_query_args );
$posts = $template_query->posts;

if ( count( $posts ) > 0 ) {
$template = _build_block_template_result_from_post( $posts[0] );
Expand Down
10 changes: 5 additions & 5 deletions src/wp-includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,18 +314,18 @@ function create_initial_rest_routes() {
$wp_post_types['wp_template']->revisions_rest_controller_class = 'WP_REST_Template_Revisions_Controller';
// Initialize the controllers. The order is important: the autosave
// controller needs both the templates and revisions controllers.
$controller = new WP_REST_Templates_Controller( 'wp_template' );
$wp_post_types['wp_template']->rest_controller = $controller;
$revisions_controller = new WP_REST_Template_Revisions_Controller( 'wp_template' );
$controller = new WP_REST_Templates_Controller( 'wp_template' );
$wp_post_types['wp_template']->rest_controller = $controller;
$revisions_controller = new WP_REST_Template_Revisions_Controller( 'wp_template' );
$wp_post_types['wp_template']->revisions_rest_controller = $revisions_controller;
$autosaves_controller = new WP_REST_Template_Autosaves_Controller( 'wp_template' );
// Unset the controller cache, it will be re-initialized when
// get_rest_controller is called.
$wp_post_types['wp_template']->rest_controller = null;
$wp_post_types['wp_template']->revisions_rest_controller = null;
// Restore the original classes.
$wp_post_types['wp_template']->rest_controller_class = $original_rest_controller_class;
$wp_post_types['wp_template']->autosave_rest_controller_class = $original_autosave_rest_controller_class;
$wp_post_types['wp_template']->rest_controller_class = $original_rest_controller_class;
$wp_post_types['wp_template']->autosave_rest_controller_class = $original_autosave_rest_controller_class;
$wp_post_types['wp_template']->revisions_rest_controller_class = $original_revisions_rest_controller_class;
// Restore the original base.
$wp_post_types['wp_template']->rest_base = 'wp_template';
Expand Down
Loading