mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Editor: Avoid undefined index notices in the Template Parts Editor.
This changes adds a leading slash when needed in the `?context=edit` path to avoid an `undefined index` notice in the Template Parts Editor. Follow-up to [52275]. Props kafleg, costdev, mukesh27, Boniu91. Fixes #54558. git-svn-id: https://develop.svn.wordpress.org/trunk@52312 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -468,6 +468,17 @@ function block_editor_rest_api_preload( array $preload_paths, $block_editor_cont
|
||||
*/
|
||||
$backup_global_post = ! empty( $post ) ? clone $post : $post;
|
||||
|
||||
foreach ( $preload_paths as &$path ) {
|
||||
if ( is_string( $path ) && ! str_starts_with( $path, '/' ) ) {
|
||||
$path = '/' . $path;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( is_array( $path ) && is_string( $path[0] ) && ! str_starts_with( $path[0], '/' ) ) {
|
||||
$path[0] = '/' . $path[0];
|
||||
}
|
||||
}
|
||||
|
||||
$preload_data = array_reduce(
|
||||
$preload_paths,
|
||||
'rest_preload_api_request',
|
||||
|
||||
Reference in New Issue
Block a user