Make WordPress Core


Ignore:
Timestamp:
10/06/2009 02:43:05 PM (15 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r11978 r11998  
    20732073        $post_type_cap = $post_type;
    20742074
     2075        $exclude_post_types = '';
     2076        foreach ( get_post_types( array('exclude_from_search' => true) ) as $_wp_post_type )
     2077            $exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $_wp_post_type);
     2078
    20752079        if ( 'any' == $post_type ) {
    2076             $where .= " AND $wpdb->posts.post_type != 'revision'";
     2080            $where .= $exclude_post_types;
    20772081        } elseif ( ! empty( $post_type ) ) {
    20782082            $where .= " AND $wpdb->posts.post_type = '$post_type'";
Note: See TracChangeset for help on using the changeset viewer.