Skip to content

Commit

Permalink
Fix: Fatal php error if a template was created by an author that was …
Browse files Browse the repository at this point in the history
…deleted. (#56990)
  • Loading branch information
jorgefilipecosta authored and fullofcaffeine committed Dec 12, 2023
1 parent 2bc1456 commit c64b349
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/compat/wordpress-6.5/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ function _gutenberg_get_wp_templates_author_text_field( $template_object ) {
case 'site':
return get_bloginfo( 'name' );
case 'user':
return get_user_by( 'id', $template_object['author'] )->get( 'display_name' );
$author = get_user_by( 'id', $template_object['author'] );
if ( ! $author ) {
return __( 'Unknown author', 'gutenberg' );
}
return $author->get( 'display_name' );
}
}

Expand Down

0 comments on commit c64b349

Please sign in to comment.