Post type registration. Exclude post types added via plugin from searches by default. Introduce register_post_type() and get_post_types(). fixes #10885

git-svn-id: https://develop.svn.wordpress.org/trunk@11998 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2009-10-06 14:43:05 +00:00
parent aeab6ed248
commit de6f496e44
2 changed files with 94 additions and 1 deletions

View File

@@ -2072,8 +2072,12 @@ class WP_Query {
$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 ) {