Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 11997)
+++ wp-includes/post.php	(working copy)
@@ -7,7 +7,22 @@
  * @since 1.5.0
  */
 
+//
+// Post Type Registration
+//
+
 /**
+ * Creates the initial post types when 'init' action is fired.
+ */
+function create_initial_post_types() {
+	register_post_type( 'post', array('exclude_from_search' => false) );
+	register_post_type( 'page', array('exclude_from_search' => false) );
+	register_post_type( 'attachment', array('exclude_from_search' => false) );
+	register_post_type( 'revision', array('exclude_from_search' => true) );
+}
+add_action( 'init', 'create_initial_post_types', 0 ); // highest priority
+
+/**
  * Retrieve attached file path based on attachment ID.
  *
  * You can optionally send it through the 'get_attached_file' filter, but by
@@ -408,6 +423,91 @@
 }
 
 /**
+ * Get a list of all registered post type objects.
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.9.0
+ * @uses $wp_post_types
+ * @see register_post_type
+ * @see get_post_types
+ *
+ * @param array|string $args An array of key => value arguments to match against the post types.
+ *  Only post types having attributes that match all arguments are returned.
+ * @return array A list of post type objects
+ */
+function get_post_type_objects( $args = array() ) {
+	global $wp_post_types;
+
+	$post_types = array();
+	foreach ( (array) $wp_post_types as $post_type ) {
+		if ( empty($args) )
+			$post_types[] = $post_type;
+		elseif ( array_intersect((array) $post_type, $args) )
+			$post_types[] = $post_type;
+	}
+
+	return $post_types;
+}
+
+/**
+ * Get a list of all registered post types.
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.9.0
+ * @uses get_post_type_objects
+ * @see register_post_type
+ *
+ * @param array|string $args An array of key => value arguments to match against the post types.
+ *  Only post types having attributes that match all arguments are returned.
+ * @return array A list of post type names
+ */
+function get_post_types( $args = array() ) {
+	$type_objects = get_post_type_objects($args);
+
+	$types = array();
+	foreach ( $type_objects as $type )
+		$types[] = $type->name;
+
+	return $types;
+}
+
+/**
+ * Register a post type. Do not use before init.
+ *
+ * A simple function for creating or modifying a post type based on the
+ * parameters given. The function will accept an array (second optional
+ * parameter), along with a string for the post type name.
+ *
+ *
+ * Optional $args contents:
+ *
+ * exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true.
+ * 
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.9.0
+ * @uses $wp_post_types Inserts new post type object into the list
+ *
+ * @param string $post_type Name of the post type.
+ * @param array|string $args See above description.
+ */
+function register_post_type($post_type, $args = array()) {
+	global $wp_post_types;
+
+	if (!is_array($wp_post_types))
+		$wp_post_types = array();
+
+	$defaults = array('exclude_from_search' => true);
+	$args = wp_parse_args($args, $defaults);
+
+	$post_type = sanitize_user($post_type, true);
+	$args['name'] = $post_type;
+	$wp_post_types[$post_type] = (object) $args;
+}
+
+/**
  * Updates the post type for the post ID.
  *
  * The page or post cache will be cleaned for the post ID.
Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 11997)
+++ wp-includes/query.php	(working copy)
@@ -2072,8 +2072,12 @@
 
 		$post_type_cap = $post_type;
 
+		$exclude_post_types = '';
+		foreach ( get_post_types( array('exclude_from_search' => true) ) as $_wp_post_type )
+			$exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $_wp_post_type);
+
 		if ( 'any' == $post_type ) {
-			$where .= " AND $wpdb->posts.post_type != 'revision'";
+			$where .= $exclude_post_types;
 		} elseif ( ! empty( $post_type ) ) {
 			$where .= " AND $wpdb->posts.post_type = '$post_type'";
 		} elseif ( $this->is_attachment ) {
