Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 17936)
+++ wp-includes/post.php	(working copy)
@@ -4138,10 +4138,11 @@
  * @uses apply_filters() Calls 'get_lastpostdate' filter
  *
  * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
+ * @param string $post_type The post type to check. Default is 'any' for any publicly queryable post type.
  * @return string The date of the last post.
  */
-function get_lastpostdate($timezone = 'server') {
-	return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone );
+function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) {
+	return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date', $post_type ), $timezone );
 }
 
 /**
@@ -4155,10 +4156,11 @@
  * @uses apply_filters() Calls 'get_lastpostmodified' filter
  *
  * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
+ * @param string $post_type The post type to check. Default is 'any' for any publicly queryable post type.
  * @return string The date the post was last modified.
  */
-function get_lastpostmodified($timezone = 'server') {
-	$lastpostmodified = _get_last_post_time( $timezone, 'modified' );
+function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) {
+	$lastpostmodified = _get_last_post_time( $timezone, 'modified', $post_type );
 
 	$lastpostdate = get_lastpostdate($timezone);
 	if ( $lastpostdate > $lastpostmodified )
@@ -4175,9 +4177,10 @@
  *
  * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
  * @param string $field Field to check. Can be 'date' or 'modified'.
+ * @param string $post_type The post type to check. Can be 'any' for any publicly queryable post type.
  * @return string The date.
  */
-function _get_last_post_time( $timezone, $field ) {
+function _get_last_post_time( $timezone, $field, $post_type ) {
 	global $wpdb;
 
 	if ( !in_array( $field, array( 'date', 'modified' ) ) )
@@ -4186,16 +4189,20 @@
 	$timezone = strtolower( $timezone );
 
 	$key = "lastpost{$field}:$timezone";
+	if ( 'any' != $post_type )
+		$key .= ':' . sanitize_key( $post_type );
 
 	$date = wp_cache_get( $key, 'timeinfo' );
 
 	if ( !$date ) {
-		$add_seconds_server = date('Z');
+		if ( 'any' == $post_type ) {
+			$post_types = get_post_types( array( 'publicly_queryable' => true ) );
+			array_walk( $post_types, array( &$wpdb, 'escape_by_ref' ) );
+			$post_types = "'" . implode( "', '", $post_types ) . "'";
+		} else {
+			$post_types = "'" . sanitize_key( $post_type ) . "'";
+		}
 
-		$post_types = get_post_types( array( 'publicly_queryable' => true ) );
-		array_walk( $post_types, array( &$wpdb, 'escape_by_ref' ) );
-		$post_types = "'" . implode( "', '", $post_types ) . "'";
-
 		switch ( $timezone ) {
 			case 'gmt':
 				$date = $wpdb->get_var("SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1");
@@ -4204,6 +4211,7 @@
 				$date = $wpdb->get_var("SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1");
 				break;
 			case 'server':
+				$add_seconds_server = date('Z');
 				$date = $wpdb->get_var("SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1");
 				break;
 		}
@@ -4462,6 +4470,7 @@
 		foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
 			wp_cache_delete( "lastpostmodified:$timezone", 'timeinfo' );
 			wp_cache_delete( "lastpostdate:$timezone", 'timeinfo' );
+			wp_cache_delete( "lastpostdate:$timezone:{$post->post_type}", 'timeinfo' );
 		}
 	}
 
