Skip to content

Commit

Permalink
Fix crash when using get_the_excerpt in the admin edit-post screen
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Oct 13, 2023
1 parent 9793aac commit 4f26ed4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2471,11 +2471,12 @@ public static function user_list_custom_column( $output, $column_name, $user_id
* @return string The potentially overriden title.
*/
public function override_post_format_title( $title, $post_id = null ) {
if ( empty( $title ) && is_admin() && function_exists( 'get_current_screen' ) ) {
if ( $post_id && empty( $title ) && is_admin() && function_exists( 'get_current_screen' ) ) {
$screen = get_current_screen();
if ( $screen && 'edit-post' === $screen->id ) {
if ( 'status' === get_post_format() ) {
return get_the_excerpt();
$post = get_post( $post_id );
return wp_trim_excerpt( wp_strip_all_tags( $post->post_content ) );
}
}
}
Expand Down

0 comments on commit 4f26ed4

Please sign in to comment.