Make WordPress Core


Ignore:
Timestamp:
06/07/2014 03:21:46 AM (11 years ago)
Author:
SergeyBiryukov
Message:

Use get_pages() instead of a raw SQL query in get_body_class().

fixes #28159.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-template.php

    r28654 r28696  
    595595        $classes[] = 'page-id-' . $page_id;
    596596
    597         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) ) )
     597        if ( get_pages( array( 'parent' => $page_id, 'number' => 1 ) ) ) {
    598598            $classes[] = 'page-parent';
     599        }
    599600
    600601        if ( $post->post_parent ) {
Note: See TracChangeset for help on using the changeset viewer.