In order to change an image’s caption, you can of course find that image in the WordPress Media Gallery and enter a new value in the “Caption” field, but what if you want to update the captions of 100 images? It’d be much more efficient to write some code to handle that for you.

As an example, here’s how you would set the captions of a few images to be the same as the image title:

Leave a reply

Your email address will not be published. Required fields are marked *