Skip to content

Commit 9e9ae1e

Browse files
committed
Editor: Fix conditionals in Template Editing Mode.
Previously, Site Editor client-side routing started using only the path query argument for loading non-editor views. The router removed the `postType` query argument, which caused an error message to be displayed when the template parts list page was reloaded. This changeset fixes the issue as it was affecting hybrid themes. Props Mamaduka, isabel_brison, ramonopoly. Fixes #58889. git-svn-id: https://develop.svn.wordpress.org/trunk@56302 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d3ea5c2 commit 9e9ae1e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/wp-admin/menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
$submenu['themes.php'][6] = array(
211211
__( 'Template Parts' ),
212212
'edit_theme_options',
213-
'site-editor.php?postType=wp_template_part&path=/wp_template_part/all',
213+
'site-editor.php?path=/wp_template_part/all',
214214
);
215215
}
216216

src/wp-admin/site-editor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
2424
}
2525

26-
$is_template_part_editor = isset( $_GET['postType'] ) && 'wp_template_part' === sanitize_key( $_GET['postType'] );
26+
$is_template_part = isset( $_GET['postType'] ) && 'wp_template_part' === sanitize_key( $_GET['postType'] );
27+
$is_template_part_path = isset( $_GET['path'] ) && 'wp_template_partall' === sanitize_key( $_GET['path'] );
28+
$is_template_part_editor = $is_template_part || $is_template_part_path;
29+
2730
if ( ! wp_is_block_theme() && ! $is_template_part_editor ) {
2831
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
2932
}

0 commit comments

Comments
 (0)