WordPress.org

Make WordPress Core

Ticket #6647: 6647.diff

File 6647.diff, 2.6 KB (added by DD32, 10 years ago)
  • wp-admin/includes/media.php

     
    586586                if ( $post && $post->post_type == 'attachment' )
    587587                        $attachments = array($post->ID => $post);
    588588                else
    589                         $attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=menu_order ASC, ID&order=DESC");
     589                        $attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
    590590        } else {
    591591                if ( is_array($GLOBALS['wp_the_query']->posts) )
    592592                        foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
  • wp-includes/media.php

     
    359359        ), $attr));
    360360
    361361        $id = intval($id);
    362         $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}");
     362        $attachments = get_children( array('post_parent'=> $id, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => $orderby) );
    363363
    364364        if ( empty($attachments) )
    365365                return '';
     
    433433function adjacent_image_link($prev = true) {
    434434        global $post;
    435435        $post = get_post($post);
    436         $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC"));
     436        $attachments = array_values( get_children( array('post_parent' => $post->post_parent, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order ASC, ID ASC') ) );
    437437
    438438        foreach ( $attachments as $k => $attachment )
    439439                if ( $attachment->ID == $post->ID )
  • wp-includes/post.php

     
    7070function &get_children($args = '', $output = OBJECT) {
    7171        if ( empty( $args ) ) {
    7272                if ( isset( $GLOBALS['post'] ) ) {
    73                         $args = 'post_parent=' . (int) $GLOBALS['post']->post_parent;
     73                        $args = array('post_parent' => (int) $GLOBALS['post']->post_parent );
    7474                } else {
    7575                        return false;
    7676                }
    7777        } elseif ( is_object( $args ) ) {
    78                 $args = 'post_parent=' . (int) $args->post_parent;
     78                $args = array('post_parent' => (int) $args->post_parent );
    7979        } elseif ( is_numeric( $args ) ) {
    80                 $args = 'post_parent=' . (int) $args;
     80                $args = array('post_parent' => (int) $args);
    8181        }
    8282
    8383        $defaults = array(