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.



Built from https://develop.svn.wordpress.org/trunk@56302


git-svn-id: http://core.svn.wordpress.org/trunk@55814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-07-25 14:33:23 +00:00
parent 80e5ebb0cc
commit 888e60a012
3 changed files with 6 additions and 3 deletions

View File

@ -210,7 +210,7 @@ if ( ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ) )
$submenu['themes.php'][6] = array( $submenu['themes.php'][6] = array(
__( 'Template Parts' ), __( 'Template Parts' ),
'edit_theme_options', 'edit_theme_options',
'site-editor.php?postType=wp_template_part&path=/wp_template_part/all', 'site-editor.php?path=/wp_template_part/all',
); );
} }

View File

@ -23,7 +23,10 @@ if ( ! ( current_theme_supports( 'block-template-parts' ) || wp_is_block_theme()
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) ); wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
} }
$is_template_part_editor = isset( $_GET['postType'] ) && 'wp_template_part' === sanitize_key( $_GET['postType'] ); $is_template_part = isset( $_GET['postType'] ) && 'wp_template_part' === sanitize_key( $_GET['postType'] );
$is_template_part_path = isset( $_GET['path'] ) && 'wp_template_partall' === sanitize_key( $_GET['path'] );
$is_template_part_editor = $is_template_part || $is_template_part_path;
if ( ! wp_is_block_theme() && ! $is_template_part_editor ) { if ( ! wp_is_block_theme() && ! $is_template_part_editor ) {
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) ); wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.4-alpha-56301'; $wp_version = '6.4-alpha-56302';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.