I have some custom post types and inside them I have some custom fields that I need to convert in post content.

Is this possible? How can I do this?


You can do this by using something similar

//Post we need to update
$id = 37;

 $custom_field = get_post_meta( $id, 'custom_field_key', true );
// Update post 37
  $mg_post = array(
      'ID'           => $id,
      'post_content' => $custom_field,

// Update the post into the database
  wp_update_post( $mg_post );

//Delete the custom field
delete_post_meta( $id, 'custom_field_key' );

Hope you got the idea. Let me know what have you tried.

| improve this answer | |
  • Your code does work, thanks! But I found a way to bulk the changes by consulting this post – bpy Apr 11 '17 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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