SQL function to copy a custom field to the post_content en mass in for wordpress

custom-fields mysql sqlbulkcopy wordpress

Question

I need to copy the contents of key value for the key post_content to another table called wp_posts into the key values for post_content.

Is there anyway to do this in bulk, like all posts in the database? This would help me greatly, thank you.

1
0
9/25/2014 8:11:28 PM

Popular Answer

Assuming your first post_content is in wp_postmeta (a custom field). Then you would copy from the wp_postmeta to the wp_posts;

UPDATE wp_posts,wp_postmeta 
SET wp_posts.post_content = wp_postmeta.meta_value 
WHERE wp_posts.ID = wp_postmeta.post_id 
AND wp_postmeta.meta_key='abstract'
0
8/7/2015 7:40:32 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow