Fix meta value querying in wp_list_pages(). props SergeyBiryukov. fixes #20376.

git-svn-id: http://core.svn.wordpress.org/trunk@22445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-07 21:48:38 +00:00
parent c26f579b13
commit 8eb8948a2e

View File

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