Fix handling of '0' as meta_value argument in get_pages(). fixes #20376.

git-svn-id: http://core.svn.wordpress.org/trunk@24238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2013-05-10 19:18:54 +00:00
parent eaeff7ef42
commit 396166203e
1 changed files with 3 additions and 3 deletions

View File

@ -3685,15 +3685,15 @@ function get_pages($args = '') {
$join = '';
$where = "$exclusions $inclusions ";
if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) {
if ( '' !== $meta_key || '' !== $meta_value ) {
$join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";
// meta_key and meta_value might be slashed
$meta_key = wp_unslash($meta_key);
$meta_value = wp_unslash($meta_value);
if ( ! empty( $meta_key ) )
if ( '' !== $meta_key )
$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key);
if ( ! empty( $meta_value ) )
if ( '' !== $meta_value )
$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);
}