Use a post_parent of 0 instead of -1 to indicate unattached posts. Props c0nstruct. see #10521

git-svn-id: http://svn.automattic.com/wordpress/trunk@11969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-09-24 17:13:11 +00:00
parent ead46cf470
commit 235afd2f97
1 changed files with 3 additions and 3 deletions

View File

@ -2282,7 +2282,7 @@ class wp_xmlrpc_server extends IXR_Server {
global $wpdb; global $wpdb;
// find any unattached files // find any unattached files
$attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '-1' AND post_type = 'attachment'" ); $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" );
if( is_array( $attachments ) ) { if( is_array( $attachments ) ) {
foreach( $attachments as $file ) { foreach( $attachments as $file ) {
if( strpos( $post_content, $file->guid ) !== false ) { if( strpos( $post_content, $file->guid ) !== false ) {
@ -2889,8 +2889,8 @@ class wp_xmlrpc_server extends IXR_Server {
return new IXR_Error(500, $errorString); return new IXR_Error(500, $errorString);
} }
// Construct the attachment array // Construct the attachment array
// attach to post_id -1 // attach to post_id 0
$post_id = -1; $post_id = 0;
$attachment = array( $attachment = array(
'post_title' => $name, 'post_title' => $name,
'post_content' => '', 'post_content' => '',