Index: src/wp-includes/class-wp-embed.php
===================================================================
--- src/wp-includes/class-wp-embed.php	(revision 53933)
+++ src/wp-includes/class-wp-embed.php	(working copy)
@@ -248,8 +248,6 @@
 		$cache      = '';
 		$cache_time = 0;
 
-		$cached_post_id = $this->find_oembed_post_id( $key_suffix );
-
 		if ( $post_ID ) {
 			$cache      = get_post_meta( $post_ID, $cachekey, true );
 			$cache_time = get_post_meta( $post_ID, $cachekey_time, true );
@@ -257,11 +255,14 @@
 			if ( ! $cache_time ) {
 				$cache_time = 0;
 			}
-		} elseif ( $cached_post_id ) {
-			$cached_post = get_post( $cached_post_id );
+		} else {
+			$cached_post_id = $this->find_oembed_post_id( $key_suffix );
+			if ( $cached_post_id ) {
+				$cached_post = get_post( $cached_post_id );
 
-			$cache      = $cached_post->post_content;
-			$cache_time = strtotime( $cached_post->post_modified_gmt );
+				$cache      = $cached_post->post_content;
+				$cache_time = strtotime( $cached_post->post_modified_gmt );
+			}
 		}
 
 		$cached_recently = ( time() - $cache_time ) < $ttl;
Index: tests/phpunit/tests/oembed/WpEmbed.php
===================================================================
--- tests/phpunit/tests/oembed/WpEmbed.php	(revision 53933)
+++ tests/phpunit/tests/oembed/WpEmbed.php	(working copy)
@@ -377,4 +377,37 @@
 		$this->wp_embed->linkifunknown = false;
 		$this->assertSame( $url, $this->wp_embed->maybe_make_link( $url ) );
 	}
+
+	/**
+	 * Test that there is no extra oembed_cache query in case global post is set.
+	 *
+	 * @ticket 56489
+	 */
+	public function test_shortcode_no_extra_queries_for_known_post() {
+		global $post, $wpdb;
+
+		$post          = $this->factory()->post->create_and_get();
+		$url           = 'https://example.com/';
+		$expected      = '<a href="' . esc_url( $url ) . '">' . esc_html( $url ) . '</a>';
+		$key_suffix    = md5( $url . serialize( wp_embed_defaults( $url ) ) );
+		$cachekey      = '_oembed_' . $key_suffix;
+		$cachekey_time = '_oembed_time_' . $key_suffix;
+
+		add_post_meta( $post->ID, $cachekey, '{{unknown}}' );
+		add_post_meta( $post->ID, $cachekey_time, 0 );
+
+		add_filter( 'pre_oembed_result', '__return_empty_string' );
+		$actual = $this->wp_embed->shortcode( array(), $url );
+		remove_filter( 'pre_oembed_result', '__return_empty_string' );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Result should be cached.
+		$actual_2 = $this->wp_embed->shortcode( array(), $url );
+
+		// Cleanup.
+		unset( $post );
+
+		$this->assertSame( $num_queries, $wpdb->num_queries );
+	}
 }
