1

I need to migrate non-WP data from an SQL database to posts in WP, and thought that using XML-RPC in a closed environment before deploying was a smart solution.

This is my first WP project, so I'm still quite new to WP.

I've managed to upload the images XML-RPC. Unfortunately, I can't see that neither metaWeblog.newMediaObject nor wp.uploadFile supports caption, alt or description fields.

I tried uploading the image and then edit the post with the ID returned from the upload. The wp.editPost returns a boolean set to true, which makes me believe the changes were set. But when I check the media library, the image caption fields are still empty.

Does anyone have any suggestions what I should do?

  • Read this -> codex.wordpress.org/Caption_Shortcode – Tomás Cot Sep 16 '14 at 12:24
  • Thanks, but unfortunately it's not a valid solution as the images are to be stored in custom fields and not as shortcodes in the body text. – haabe Sep 16 '14 at 12:32
  • So I finally found a clue. The media article type stores the caption in post_excerpt, description in post_content. I'm not quite sure which field stores the alt text, but I'm quite happy with just storing the caption in post_excerpt. – haabe Sep 16 '14 at 13:16
  • Were you able to find a way to create the caption while using wp.uploadFile? I'm stuck in this same boat too and fear that I may have to make a separate call to update the image post after the image has been uploaded. – bigmike7801 Jun 11 '15 at 14:35
1

So I finally found a clue. The media article type stores the caption in post_excerpt, description in post_content. I'm not quite sure which field stores the alt text, but I'm quite happy with just storing the caption in post_excerpt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.