mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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:
parent
eaeff7ef42
commit
396166203e
@ -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);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user