Site Editor: Fix PHP warning pre-loading page REST requests.

Fix a PHP warning when opening a page directly in the site editor, eg by navigating to the URL `/wp-admin/site-editor.php?p=%2Fpage&postId=200`, caused by an undefined variable name.

Props abcd95, joemcgill, narenin, soyebsalar, websiteredev, wildworks.
Fixes .


git-svn-id: https://develop.svn.wordpress.org/trunk@60061 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Wilson 2025-03-20 23:01:33 +00:00
parent 6436bf1521
commit 1563bf7344

@ -239,7 +239,7 @@ if ( $block_editor_context->post ) {
$preload_paths[] = add_query_arg(
'slug',
// @see https://github.com/WordPress/gutenberg/blob/e093fefd041eb6cc4a4e7f67b92ab54fd75c8858/packages/core-data/src/private-selectors.ts#L244-L254
empty( $block_editor_context->post->post_name ) ? 'page' : 'page-' . $post->post_name,
empty( $block_editor_context->post->post_name ) ? 'page' : 'page-' . $block_editor_context->post->post_name,
'/wp/v2/templates/lookup'
);
}