From ea26434b7d6b6589a733d3b9ebb99e78256514a3 Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Mon, 13 Feb 2023 01:16:16 +0000 Subject: [PATCH] Use post object instead of id. --- packages/block-library/src/post-title/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/post-title/index.php b/packages/block-library/src/post-title/index.php index 1f03b12fc2b46c..e123a9993304b8 100644 --- a/packages/block-library/src/post-title/index.php +++ b/packages/block-library/src/post-title/index.php @@ -19,8 +19,8 @@ function render_block_core_post_title( $attributes, $content, $block ) { return ''; } - $post_ID = $block->context['postId']; - $title = get_the_title(); + $post = get_post( $block->context['postId'] ); + $title = get_the_title( $post ); if ( ! $title ) { return ''; @@ -33,7 +33,7 @@ function render_block_core_post_title( $attributes, $content, $block ) { if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) { $rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : ''; - $title = sprintf( '%4$s', get_the_permalink( $post_ID ), esc_attr( $attributes['linkTarget'] ), $rel, $title ); + $title = sprintf( '%4$s', get_the_permalink( $post ), esc_attr( $attributes['linkTarget'] ), $rel, $title ); } $classes = array();