diff --git src/wp-includes/post.php src/wp-includes/post.php
index 0e09610521..4b1e177273 100644
--- src/wp-includes/post.php
+++ src/wp-includes/post.php
@@ -6443,7 +6443,7 @@ function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) {
 
 	$lastpostmodified = _get_last_post_time( $timezone, 'modified', $post_type );
 
-	$lastpostdate = get_lastpostdate( $timezone );
+	$lastpostdate = get_lastpostdate( $timezone, $post_type );
 	if ( $lastpostdate > $lastpostmodified ) {
 		$lastpostmodified = $lastpostdate;
 	}
@@ -6452,13 +6452,15 @@ function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) {
 	 * Filters the most recent time that a post was modified.
 	 *
 	 * @since 2.3.0
+	 * @since 5.4.0 - Add `$post_type` as the third parameter.
 	 *
 	 * @param string|false $lastpostmodified The most recent time that a post was modified, in 'Y-m-d H:i:s' format.
 	 *                                       False on failure.
 	 * @param string       $timezone         Location to use for getting the post modified date.
 	 *                                       See get_lastpostdate() for accepted `$timezone` values.
+	 * @param string       $post_type        The post type to check.
 	 */
-	return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
+	return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone, $post_type );
 }
 
 /**
diff --git tests/phpunit/tests/post/getLastPostModified.php tests/phpunit/tests/post/getLastPostModified.php
new file mode 100644
index 0000000000..ccb586c594
--- /dev/null
+++ tests/phpunit/tests/post/getLastPostModified.php
@@ -0,0 +1,73 @@
+<?php
+
+/**
+ * @group post
+ */
+class Tests_Post_GetLastPostModified extends WP_UnitTestCase {
+	/**
+	 * @ticket 47777
+	 */
+	public function test_get_lastpostmodified() {
+		$post_post_date          = '2018-01-30 16:09:28';
+		$post_post_modified_date = '2018-02-28 17:10:29';
+
+		$book_post_date          = '2019-03-30 18:11:30';
+		$book_post_modified_date = '2019-04-30 19:12:31';
+
+		// Register book post type.
+		register_post_type( 'book', array( 'has_archive' => true ) );
+
+		// Create a simple post.
+		$simple_post_id = self::factory()->post->create(
+			array(
+				'post_title'    => 'Simple Post',
+				'post_type'     => 'post',
+				'post_date'     => $post_post_date,
+			)
+		);
+
+		// Create custom type post
+		$book_cpt_id = self::factory()->post->create(
+			array(
+				'post_title'    => 'Book CPT',
+				'post_type'     => 'book',
+				'post_date'     => $book_post_date
+			)
+		);
+
+		// Update `post_modified` and `post_modified_gmt`.
+		global $wpdb;
+
+		$wpdb->update(
+			$wpdb->posts,
+			array(
+				'post_modified'     => $post_post_modified_date,
+				'post_modified_gmt' => $post_post_modified_date,
+			),
+			array(
+				'ID' => $simple_post_id,
+			)
+		);
+
+		$wpdb->update(
+			$wpdb->posts,
+			array(
+				'post_modified'     => $book_post_modified_date,
+				'post_modified_gmt' => $book_post_modified_date,
+			),
+			array(
+				'ID' => $book_cpt_id,
+			)
+		);
+
+		// Delete cache to get the updated modified date.
+		wp_cache_delete( $simple_post_id, 'posts' );
+		wp_cache_delete( $book_cpt_id, 'posts' );
+
+		$post_lastpost_modified = get_lastpostmodified( 'blog', 'post' );
+		$book_lastpost_modified = get_lastpostmodified( 'blog', 'book' );
+
+		$this->assertEquals( $post_post_modified_date, $post_lastpost_modified );
+		$this->assertEquals( $book_post_modified_date, $book_lastpost_modified );
+	}
+}
