From 88e87200183e8d7949550da86c8cbaeebdbdcd9d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 7 Jun 2014 03:21:46 +0000 Subject: [PATCH] Use get_pages() instead of a raw SQL query in get_body_class(). fixes #28159. git-svn-id: https://develop.svn.wordpress.org/trunk@28696 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post-template.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 60d09c7660..1f96b448e9 100644 --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -594,8 +594,9 @@ function get_body_class( $class = '' ) { $classes[] = 'page-id-' . $page_id; - if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status = 'publish' LIMIT 1", $page_id) ) ) + if ( get_pages( array( 'parent' => $page_id, 'number' => 1 ) ) ) { $classes[] = 'page-parent'; + } if ( $post->post_parent ) { $classes[] = 'page-child';