1

I have a lot of meta_key and their relative meta_value associated to a post, for example, post_id = 4319.

How can I assign, using an SQL query, all the values to another post_id? for example, post_id = 6219.

  • Can you please share details of what you've tried already? Example code is good, so are links to other posts. – Andrew Jan 11 '18 at 15:52
1
UPDATE wp_postmeta SET post_id = 6219 WHERE post_id = 4319
  • 1
    Thanks Otto. Your code works fine for me i need to transfer only some rows from post to post so i modified your query like this: UPDATE wp_postmeta SET post_id = 6219 WHERE post_id = 4319 AND meta_key LIKE '%foo%'; – FRA Jan 11 '18 at 17:40

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.