mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
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:
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user