WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating posts by using wp_insert_post function. It works fine as I provide values in array required. Sometimes it is required to create a post having gallery. Without any problem, it also works fine.

But when there is requirement of adding captions to gallery images, I'm not able to add them programmatically. All captions are stored in an array.

Is there a way or hook to add them in gallery by code? Or in other way how to add caption array element beneath each image of gallery?

share|improve this question
Anyone, here to tell? – 10wtaylor Apr 25 '13 at 18:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.