Make WordPress Core

Ticket #61796: 61796.2.patch

File 61796.2.patch, 1.1 KB (added by sayedulsayem, 7 months ago)

patch added from the suggestion

  • src/wp-admin/site-editor.php

    diff --git a/src/wp-admin/site-editor.php b/src/wp-admin/site-editor.php
    index 7e2e763dee..8c98b8fc44 100644
    a b $custom_settings['__experimentalAdditionalBlockPatternCategories'] = WP_Block_Pa 
    7373
    7474$editor_settings = get_block_editor_settings( $custom_settings, $block_editor_context );
    7575
    76 if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) {
     76if ( isset( $_GET['postType'] ) && isset( $_GET['postId'] ) ) {
    7777        $post_type = get_post_type_object( $_GET['postType'] );
    7878        if ( ! $post_type ) {
    79                 wp_die( __( 'Invalid post type.' ) );
     79                wp_die(
     80                        __( 'Invalid post type.' ),
     81                        __( '404  Not Found' ),
     82                        array(
     83                                'link_url'  => admin_url( 'site-editor.php' ),
     84                                'link_text' => __( 'Return to site editor' ),
     85                        )
     86                );
     87        }
     88        $post_object = get_post( $_GET['postId'] );
     89        if ( ! $post_object || $post_object->post_type !== $post_type->name ) {
     90                wp_die(
     91                        __( 'Invalid page ID.' ),
     92                        __( '404  Not Found' ),
     93                        array(
     94                                'link_url'  => admin_url( 'site-editor.php' ),
     95                                'link_text' => __( 'Return to site editor' ),
     96                        )
     97                );
    8098        }
    8199}
    82100