Skip to content

Commit

Permalink
check if post id is int
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Nov 1, 2024
1 parent 6e9ff44 commit b3481f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/wp-admin/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ static function ( $classes ) {
$context_settings = array( 'name' => 'core/edit-site' );

if ( ! empty( $_GET['postId'] ) ) {
$context_settings['post'] = get_post( $_GET['postId'] );
$post_id = (int) $_GET['postId'];
if ( $post_id ) {
$context_settings['post'] = get_post( $post_id );
}
}

$block_editor_context = new WP_Block_Editor_Context( $context_settings );
Expand Down

0 comments on commit b3481f1

Please sign in to comment.