WordPress.org

Make WordPress Core

Ticket #19367: 19367.diff

File 19367.diff, 990 bytes (added by scribu, 7 years ago)
  • wp-admin/includes/post.php

    diff --git wp-admin/includes/post.php wp-admin/includes/post.php
    index 831c702..c3f4c25 100644
    function _fix_attachment_links_replace_cb($match) { 
    794794}
    795795
    796796/**
    797  * Move child posts to a new parent.
    798  *
    799  * @since 2.3.0
    800  * @access private
    801  *
    802  * @param unknown_type $old_ID
    803  * @param unknown_type $new_ID
    804  * @return unknown
    805  */
    806 function _relocate_children( $old_ID, $new_ID ) {
    807         global $wpdb;
    808         $old_ID = (int) $old_ID;
    809         $new_ID = (int) $new_ID;
    810 
    811         $children = $wpdb->get_col( $wpdb->prepare("
    812                 SELECT post_id
    813                 FROM $wpdb->postmeta
    814                 WHERE meta_key = '_wp_attachment_temp_parent'
    815                 AND meta_value = %d", $old_ID) );
    816 
    817         foreach ( $children as $child_id ) {
    818                 $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('ID' => $child_id) );
    819                 delete_post_meta($child_id, '_wp_attachment_temp_parent');
    820         }
    821 }
    822 
    823 /**
    824797 * Get all the possible statuses for a post_type
    825798 *
    826799 * @since 2.5.0