Fix warnings in WordPress importer. props briancolinger, fixes #13263.
git-svn-id: https://develop.svn.wordpress.org/trunk@14497 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4b724a5d34
commit
40aa2e543b
|
@ -472,8 +472,8 @@ class WP_Import {
|
||||||
$post_parent = (int) $post_parent;
|
$post_parent = (int) $post_parent;
|
||||||
if ($post_parent) {
|
if ($post_parent) {
|
||||||
// if we already know the parent, map it to the local ID
|
// if we already know the parent, map it to the local ID
|
||||||
if ( $parent = $this->post_ids_processed[$post_parent] ) {
|
if ( isset( $this->post_ids_processed[$post_parent] ) ) {
|
||||||
$post_parent = $parent; // new ID of the parent
|
$post_parent = $this->post_ids_processed[$post_parent]; // new ID of the parent
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// record the parent for later
|
// record the parent for later
|
||||||
|
@ -760,8 +760,12 @@ class WP_Import {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
foreach ($this->orphans as $child_id => $parent_id) {
|
foreach ($this->orphans as $child_id => $parent_id) {
|
||||||
$local_child_id = $this->post_ids_processed[$child_id];
|
$local_child_id = $local_parent_id = false;
|
||||||
$local_parent_id = $this->post_ids_processed[$parent_id];
|
if ( isset( $this->post_ids_processed[$child_id] ) )
|
||||||
|
$local_child_id = $this->post_ids_processed[$child_id];
|
||||||
|
if ( isset( $this->post_ids_processed[$parent_id] ) )
|
||||||
|
$local_parent_id = $this->post_ids_processed[$parent_id];
|
||||||
|
|
||||||
if ($local_child_id and $local_parent_id) {
|
if ($local_child_id and $local_parent_id) {
|
||||||
$wpdb->update($wpdb->posts, array('post_parent' => $local_parent_id), array('ID' => $local_child_id) );
|
$wpdb->update($wpdb->posts, array('post_parent' => $local_parent_id), array('ID' => $local_child_id) );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue