diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:51:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:51:22 +0000 |
commit | fc0a79914946dac00ccd51b1aacffe267de7210e (patch) | |
tree | 1403384efbfe8f8776ff60aaa40f7d535c02c822 /wp-includes/blocks/post-author-name.php | |
parent | Releasing progress-linux version 6.5.5+dfsg1-1~progress7.99u1. (diff) | |
download | wordpress-fc0a79914946dac00ccd51b1aacffe267de7210e.tar.xz wordpress-fc0a79914946dac00ccd51b1aacffe267de7210e.zip |
Merging upstream version 6.6.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/blocks/post-author-name.php')
-rw-r--r-- | wp-includes/blocks/post-author-name.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/wp-includes/blocks/post-author-name.php b/wp-includes/blocks/post-author-name.php index c5c6d14..effc839 100644 --- a/wp-includes/blocks/post-author-name.php +++ b/wp-includes/blocks/post-author-name.php @@ -8,17 +8,20 @@ /** * Renders the `core/post-author-name` block on the server. * + * @since 6.2.0 + * * @param array $attributes Block attributes. * @param string $content Block default content. * @param WP_Block $block Block instance. * @return string Returns the rendered post author name block. */ function render_block_core_post_author_name( $attributes, $content, $block ) { - if ( ! isset( $block->context['postId'] ) ) { - return ''; + if ( isset( $block->context['postId'] ) ) { + $author_id = get_post_field( 'post_author', $block->context['postId'] ); + } else { + $author_id = get_query_var( 'author' ); } - $author_id = get_post_field( 'post_author', $block->context['postId'] ); if ( empty( $author_id ) ) { return ''; } @@ -42,6 +45,8 @@ function render_block_core_post_author_name( $attributes, $content, $block ) { /** * Registers the `core/post-author-name` block on the server. + * + * @since 6.2.0 */ function register_block_core_post_author_name() { register_block_type_from_metadata( |