Skip to content
Permalink
Browse files Browse the repository at this point in the history
Query: Ensure that queries work correctly with post type names with s…
…pecial characters.

Built from https://develop.svn.wordpress.org/trunk@39952


git-svn-id: http://core.svn.wordpress.org/trunk@39889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ocean90 committed Jan 26, 2017
1 parent a44f8db commit 8538429
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions wp-includes/class-wp-query.php
Expand Up @@ -2257,12 +2257,12 @@ public function get_posts() {
if ( empty( $in_search_post_types ) ) {
$where .= ' AND 1=0 ';
} else {
$where .= " AND {$wpdb->posts}.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
$where .= " AND {$wpdb->posts}.post_type IN ('" . join( "', '", array_map( 'esc_sql', $in_search_post_types ) ) . "')";
}
} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
$where .= " AND {$wpdb->posts}.post_type IN ('" . join("', '", $post_type) . "')";
$where .= " AND {$wpdb->posts}.post_type IN ('" . join("', '", esc_sql( $post_type ) ) . "')";
} elseif ( ! empty( $post_type ) ) {
$where .= " AND {$wpdb->posts}.post_type = '$post_type'";
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_type = %s", $post_type );
$post_type_object = get_post_type_object ( $post_type );
} elseif ( $this->is_attachment ) {
$where .= " AND {$wpdb->posts}.post_type = 'attachment'";
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Expand Up @@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-39951';
$wp_version = '4.8-alpha-39952';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

1 comment on commit 8538429

@Jxysir
Copy link

@Jxysir Jxysir commented on 8538429 Nov 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how use?

Please sign in to comment.