WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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've just moved to another theme, and it uses the custom field bigimage for associating an image with a post, instead of using WordPress's post thumbnails. How do I copy the URLs of all existing post-thumnails to their corresponding post's bigimage custom field?

Could we possibly write a bunch of MySQL statements to achieve this?

share|improve this question
up vote 1 down vote accepted

I wouldn't bother doing that.

I'd just find the places in your theme files that call the custom field (probably something like "echo get_post_meta('bigimage')" or something) and replace those with a the_post_thumbnail() tag.

This saves you the trouble of messing with the data, and it makes administration much, much simpler going forward--which is kind of the point of post thumbnails. And it'll probably take less time than rigging some SQL to copy all that data.

share|improve this answer

Sorry for not having a specific answer but this will point you in the right direction, you should be able to do this in your functions.php.

First off you probably want to get the post thumbnial using get_the_post_thumbnail

I would create an array function to get the post thumbnails, I will assume the "bigimage" has a key value in $wpdb->postmeta. If so you can use the http://codex.wordpress.org/Function_Reference/add_post_meta to then insert the image url or id or whatever into that custom field per post.

share|improve this answer

Your Answer


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

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