WordPress.org

Forums

The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

JSON API
Bug in save with attachements (1 post)

  1. timfield
    Member
    Posted 3 years 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

  • JSON API
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic