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?

4
  • Read this -> codex.wordpress.org/Caption_Shortcode
    – Tomás Cot
    Sep 16, 2014 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, 2014 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, 2014 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. Jun 11, 2015 at 14:35

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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