Take the 2-minute tour ×

I need to move (or copy) the contents of a custom field into the main post body, replacing any existing content.

I need to do this for a few hundred posts...Is there a quick way of doing this?

I can manage moving values from one meta field to another in SQL, but i'm not sure how to do this with post content...

If anyone could give me some pointers that would be much appreciated.

share|improve this question
add comment

1 Answer

For SQL, the post's content is saved in "wp_posts" table under "post_content" column. When doing this from phpmyadmin, you'll have to take care that you're updating only the main post & not one of it's revisions

If you're looking for some wordpress based solution, the wordpress way to do it is to use wp_update_post

// Update post 37
  $my_post = array();
  $my_post['ID'] = 37;
  $my_post['post_content'] = get_post_meta($my_post['ID'], 'meta_key', true);

// Update the post into the database
  wp_update_post( $my_post );
share|improve this answer
Thanks Mridul, yeah there's all sorts of different content types under wp_posts as well so i'm avoiding doing it this way to be safe. I shall investigate the wordpress way that you suggested. –  jasonc Nov 9 '12 at 1:51
add comment

Your Answer


