WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
Bug in save with attachements (1 post)

  1. timfield
    Member
    Posted 1 year ago #

    Hey there is a bug here, when creating an attachment, upload works fine but JSON_API_Attachment is passed the attachment id to the constructor, not the attachement object. I think the following patch will fix.

    --- wp-content/plugins/json-api/models/post.php	(revision 594257)
    +++ wp-content/plugins/json-api/models/post.php	(working copy)
    @@ -114,7 +114,7 @@
           include_once ABSPATH . '/wp-admin/includes/media.php';
           include_once ABSPATH . '/wp-admin/includes/image.php';
           $attachment_id = media_handle_upload('attachment', $this->id);
    -      $this->attachments[] = new JSON_API_Attachment($attachment_id);
    +      $this->attachments[] = new JSON_API_Attachment( get_post($attachment_id) );
           unset($_FILES['attachment']);
         }

    http://wordpress.org/extend/plugins/json-api/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic