Index: src/wp-includes/class-wp-query.php
===================================================================
--- src/wp-includes/class-wp-query.php	(revision 43946)
+++ src/wp-includes/class-wp-query.php	(working copy)
@@ -4133,6 +4133,40 @@
 			return;
 		}
 
+		$elements = $this->generate_postdata( $post );
+		if( false === $elements ){
+			return;
+		}
+
+		$id = $elements['id'];
+		$authordata = $elements['authordata'];
+		$currentday = $elements['currentday'];
+		$currentmonth  = $elements['currentmonth'];
+		$page  = $elements['page'];
+		$pages = $elements['pages'];
+		$multipage = $elements['multipage'];
+		$more = $elements['more'];
+		$numpages  = $elements['numpages'];
+
+		return true;
+	}
+
+	/**
+	 * Generate post data.
+	 *
+	 * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
+	 * @return array  $elements Elements of post
+	 */
+	public function generate_postdata( $post ) {
+
+		if ( ! ( $post instanceof WP_Post ) ) {
+			$post = get_post( $post );
+		}
+
+		if ( ! $post ) {
+			return false;
+		}
+
 		$id = (int) $post->ID;
 
 		$authordata = get_userdata( $post->post_author );
@@ -4209,7 +4243,9 @@
 		 */
 		do_action_ref_array( 'the_post', array( &$post, &$this ) );
 
-		return true;
+		$elements = compact( $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages );
+
+		return $elements;
 	}
 	/**
 	 * After looping through a nested query, this function
Index: src/wp-includes/default-filters.php
===================================================================
--- src/wp-includes/default-filters.php	(revision 43946)
+++ src/wp-includes/default-filters.php	(working copy)
@@ -170,7 +170,7 @@
 add_filter( 'the_excerpt', 'convert_chars' );
 add_filter( 'the_excerpt', 'wpautop' );
 add_filter( 'the_excerpt', 'shortcode_unautop' );
-add_filter( 'get_the_excerpt', 'wp_trim_excerpt' );
+add_filter( 'get_the_excerpt', 'wp_trim_excerpt', 10, 2 );
 
 add_filter( 'the_post_thumbnail_caption', 'wptexturize' );
 add_filter( 'the_post_thumbnail_caption', 'convert_smilies' );
Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 43946)
+++ src/wp-includes/formatting.php	(working copy)
@@ -3625,14 +3625,17 @@
  * The ' [&hellip;]' string can be modified by plugins/themes using the {@see 'excerpt_more'} filter
  *
  * @since 1.5.0
+ * @since 5.0.0 Added '$post' param
  *
  * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated.
+ * @param WP_Post|object|int $post Optional. WP_Post instance or Post ID/object. Default is null.
  * @return string The excerpt.
  */
-function wp_trim_excerpt( $text = '' ) {
+function wp_trim_excerpt( $text = '', $post = null ) {
 	$raw_excerpt = $text;
 	if ( '' == $text ) {
-		$text = get_the_content( '' );
+	    $post = get_post( $post );
+		$text = get_the_content( '', false, $post );
 
 		$text = strip_shortcodes( $text );
 
Index: src/wp-includes/post-template.php
===================================================================
--- src/wp-includes/post-template.php	(revision 43946)
+++ src/wp-includes/post-template.php	(working copy)
@@ -230,12 +230,14 @@
  * Display the post content.
  *
  * @since 0.71
+ * @since 5.0.0 Added '$post' param
  *
  * @param string $more_link_text Optional. Content for when there is more text.
  * @param bool   $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
+ * @param WP_Post|object|int $post Optional. WP_Post instance or Post ID/object. Default is -1 as passed to get_post.
  */
-function the_content( $more_link_text = null, $strip_teaser = false ) {
-	$content = get_the_content( $more_link_text, $strip_teaser );
+function the_content( $more_link_text = null, $strip_teaser = false, $post = -1 ) {
+	$content = get_the_content( $more_link_text, $strip_teaser, $post );
 
 	/**
 	 * Filters the post content.
@@ -253,6 +255,7 @@
  * Retrieve the post content.
  *
  * @since 0.71
+ * @since 5.0.0 Added '$post' param
  *
  * @global int   $page      Page number of a single post/page.
  * @global int   $more      Boolean indicator for whether single post/page is being viewed.
@@ -263,13 +266,25 @@
  *
  * @param string $more_link_text Optional. Content for when there is more text.
  * @param bool   $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
+ * @param WP_Post|object|int $post Optional. WP_Post instance or Post ID/object. Default is -1 as passed to get_post.
  * @return string
  */
-function get_the_content( $more_link_text = null, $strip_teaser = false ) {
+function get_the_content( $more_link_text = null, $strip_teaser = false, $post = -1 ) {
 	global $page, $more, $preview, $pages, $multipage;
 
-	$post = get_post();
 
+	if ( -1 === $post ) {
+		$post = get_post();
+		$elements = compact( $page, $more, $preview, $pages, $multipage );
+	} else {
+		$post = get_post( $post );
+		$elements = generate_postdata( $post );
+	}
+
+	if( $post instanceof WP_Post || ! is_array( $elements ) ) {
+		return '';
+	}
+
 	if ( null === $more_link_text ) {
 		$more_link_text = sprintf(
 			'<span aria-label="%1$s">%2$s</span>',
@@ -290,11 +305,11 @@
 		return get_the_password_form( $post );
 	}
 
-	if ( $page > count( $pages ) ) { // if the requested page doesn't exist
-		$page = count( $pages ); // give them the highest numbered page that DOES exist
+	if ( $elements['page'] > count( $elements['pages'] ) ) { // if the requested page doesn't exist
+		$elements['page'] = count( $elements['pages'] ); // give them the highest numbered page that DOES exist
 	}
 
-	$content = $pages[ $page - 1 ];
+	$content = $elements['pages'][ $elements['page'] - 1 ];
 	if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
 		$content = explode( $matches[0], $content, 2 );
 		if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) {
@@ -306,13 +321,13 @@
 		$content = array( $content );
 	}
 
-	if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) ) {
+	if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $elements['multipage'] || $elements['page'] == 1 ) ) {
 		$strip_teaser = true;
 	}
 
 	$teaser = $content[0];
 
-	if ( $more && $strip_teaser && $has_teaser ) {
+	if ( $elements['more'] && $strip_teaser && $has_teaser ) {
 		$teaser = '';
 	}
 
@@ -319,7 +334,7 @@
 	$output .= $teaser;
 
 	if ( count( $content ) > 1 ) {
-		if ( $more ) {
+		if ( $elements['more'] ) {
 			$output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
 		} else {
 			if ( ! empty( $more_link_text ) ) {
@@ -338,7 +353,7 @@
 		}
 	}
 
-	if ( $preview ) { // Preview fix for JavaScript bug with foreign languages.
+	if ( $elements['preview'] ) { // Preview fix for JavaScript bug with foreign languages.
 		$output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
 	}
 
Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 43946)
+++ src/wp-includes/query.php	(working copy)
@@ -1111,3 +1111,23 @@
 
 	return false;
 }
+
+/**
+ * Generate post data.
+ *
+ * @since 5.0.0
+ *
+ * @global WP_Query $wp_query Global WP_Query instance.
+ *
+ * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
+ * @return bool True when finished.
+ */
+function generate_postdata( $post ) {
+	global $wp_query;
+
+	if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) {
+		return $wp_query->generate_postdata( $post );
+	}
+
+	return false;
+}
