Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 31834)
+++ src/wp-includes/query.php	(working copy)
@@ -4568,12 +4568,18 @@
 	 *
 	 * @since 4.1.0
 	 *
-	 * @param WP_Post $post Post data.
+	 * @param WP_Post $p Post data or post ID.
 	 * @return bool True when finished.
 	 */
-	public function setup_postdata( $post ) {
-		global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
+	public function setup_postdata( $p ) {
+		global $id, $authordata, $currentday, $currentmonth, $post, $page, $pages, $multipage, $more, $numpages;
 
+		if ( ! ( $p instanceof WP_Post ) ) {
+			$p = get_post( $p );
+		}
+
+		$post = $p;
+
 		$id = (int) $post->ID;
 
 		$authordata = get_userdata($post->post_author);
