| @@ -211,9 +211,8 @@ | ||
| 211 | 211 | /** |
| 212 | 212 | * Gets the post data for the smart link. |
| 213 | 213 | * |
| 214 | 214 | * @since 3.16.0 |
| 215 | - * @since 3.24.3 Uses the display name of the source post's author. | |
| 216 | 215 | * |
| 217 | 216 | * @return SmartLinkPostData The post data. |
| 218 | 217 | */ |
| 219 | 218 | private function get_post_data(): array { |
| @@ -268,8 +267,14 @@ | ||
| 268 | 267 | ); |
| 269 | 268 | $paragraph = $error_paragraph; |
| 270 | 269 | } |
| 271 | 270 | |
| 271 | + $author_name = get_the_author(); | |
| 272 | + if ( '' === $author_name ) { | |
| 273 | + // If the author name is empty, use the author login name. | |
| 274 | + $author_name = get_the_author_meta( 'user_login', intval( $post->post_author ) ); | |
| 275 | + } | |
| 276 | + | |
| 272 | 277 | $post_type = get_post_type_object( $post->post_type ); |
| 273 | 278 | if ( null === $post_type ) { |
| 274 | 279 | return $empty_post_data; |
| 275 | 280 | } |
| @@ -293,9 +298,9 @@ | ||
| 293 | 298 | 'parsely_canonical_url' => Parsely::get_canonical_url_from_post( $post ), |
| 294 | 299 | 'edit_link' => get_edit_post_link( $post, 'html' ) !== null ? get_edit_post_link( $post, 'html' ) : '', |
| 295 | 300 | 'is_first_paragraph' => $paragraph['is_first_paragraph'], |
| 296 | 301 | 'is_last_paragraph' => $paragraph['is_last_paragraph'], |
| 297 | - 'author' => get_the_author_meta( 'display_name', (int) $post->post_author ), | |
| 302 | + 'author' => $author_name, | |
| 298 | 303 | 'date' => (string) ( get_the_date( '', $post ) !== false ? get_the_date( '', $post ) : '' ), |
| 299 | 304 | 'image' => get_the_post_thumbnail_url( $post, 'medium' ) !== false ? get_the_post_thumbnail_url( $post, 'medium' ) : '', |
| 300 | 305 | ); |
| 301 | 306 | |