From 3922b0cff7390b339d26590049b5e1f3af53f309 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 10 Jul 2013 06:11:12 +0000 Subject: [PATCH] Avoid notice in XML-RPC when attaching uploads, when attachments do not have a guid in the DB. props ericmann, markoheijnen. fixes #18310. git-svn-id: https://develop.svn.wordpress.org/trunk@24639 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/class-wp-xmlrpc-server.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 88c1621aab..b67f99d639 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -4347,7 +4347,7 @@ class wp_xmlrpc_server extends IXR_Server { $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" ); if ( is_array( $attachments ) ) { foreach ( $attachments as $file ) { - if ( strpos( $post_content, $file->guid ) !== false ) + if ( ! empty( $file->guid ) && strpos( $post_content, $file->guid ) !== false ) $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) ); } }