Make WordPress Core


Ignore:
Timestamp:
07/25/2023 02:31:04 PM (16 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/site-editor.php

    r56206 r56302  
    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
    2730if ( ! wp_is_block_theme() && ! $is_template_part_editor ) {
    2831    wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
Note: See TracChangeset for help on using the changeset viewer.