Use a post_parent of 0 instead of -1 to indicate unattached posts. Props c0nstruct. see #10521
git-svn-id: https://develop.svn.wordpress.org/trunk@11969 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
578e956287
commit
d11f390d69
@ -2282,7 +2282,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
global $wpdb;
|
||||
|
||||
// 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 ) ) {
|
||||
foreach( $attachments as $file ) {
|
||||
if( strpos( $post_content, $file->guid ) !== false ) {
|
||||
@ -2889,8 +2889,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
return new IXR_Error(500, $errorString);
|
||||
}
|
||||
// Construct the attachment array
|
||||
// attach to post_id -1
|
||||
$post_id = -1;
|
||||
// attach to post_id 0
|
||||
$post_id = 0;
|
||||
$attachment = array(
|
||||
'post_title' => $name,
|
||||
'post_content' => '',
|
||||
|
Loading…
x
Reference in New Issue
Block a user