Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 15686)
+++ wp-includes/post.php	(working copy)
@@ -2074,7 +2074,7 @@
 
 	$post = get_post($postid, $mode);
 
-	if ( 
+	if (
 		( OBJECT == $mode && empty( $post->ID ) ) ||
 		( OBJECT != $mode && empty( $post['ID'] ) )
 	)
@@ -3892,18 +3892,21 @@
  * @return string The date of the last post.
  */
 function get_lastpostdate($timezone = 'server') {
-	global $cache_lastpostdate, $wpdb, $blog_id;
+	global $cache_lastpostdate, $wpdb, $blog_id, $wp_query;
 	$add_seconds_server = date('Z');
 	if ( !isset($cache_lastpostdate[$blog_id][$timezone]) ) {
+		$post_types = apply_filters( 'get_lastpostdate_post_types', $wp_query->query_vars['post_type'] );
+		array_walk( $post_types, array( &$wpdb, 'escape_by_ref' ) );
+		$post_types = "'" . implode( "', '", $post_types ) . "'";
 		switch(strtolower($timezone)) {
 			case 'gmt':
-				$lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1");
+				$lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_date_gmt DESC LIMIT 1");
 				break;
 			case 'blog':
-				$lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1");
+				$lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_date_gmt DESC LIMIT 1");
 				break;
 			case 'server':
-				$lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1");
+				$lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_date_gmt DESC LIMIT 1");
 				break;
 		}
 		$cache_lastpostdate[$blog_id][$timezone] = $lastpostdate;
@@ -3929,7 +3932,7 @@
  * @return string The date the post was last modified.
  */
 function get_lastpostmodified($timezone = 'server') {
-	global $wpdb;
+	global $wpdb, $wp_query;
 
 	$add_seconds_server = date('Z');
 	$timezone = strtolower( $timezone );
@@ -3938,15 +3941,18 @@
 	if ( $lastpostmodified )
 		return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
 
+	$post_types = apply_filters( 'get_lastpostmodified_post_types', $wp_query->query_vars['post_type'] );
+	array_walk( $post_types, array( &$wpdb, 'escape_by_ref' ) );
+	$post_types = "'" . implode( "', '", $post_types ) . "'";
 	switch ( strtolower($timezone) ) {
 		case 'gmt':
-			$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
+			$lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_modified_gmt DESC LIMIT 1");
 			break;
 		case 'blog':
-			$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
+			$lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_modified_gmt DESC LIMIT 1");
 			break;
 		case 'server':
-			$lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
+			$lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_modified_gmt DESC LIMIT 1");
 			break;
 	}
 
