Move value from one meta key to another (2 posts)

  1. nadine00
    Posted 4 years ago #

    How would I structure a MySQL query to move the value from one meta_key to another meta_key?

    eg: I have an old meta_key of "guest_sort" associated with "posts" to "tf_exhibitor_sort" under the post type "exhibitor_listing"


  2. krembo99
    Posted 4 years ago #

    I believe I have already answered this question on another board, but here goes again for the sake of not leaving unanswered questions (and archive)

    When you move a post , the meta keys and values associated with it should remain with the post itself, like all post meta (including the attachments , custom-image etc..) - so there should be no problem to keep the values. Normally ,The only thing that SHOULD happen is a change the 'post_type' property of the post.

    but anyhow, if your question is about RENAMING meta keys , then this should dod the trick :

    update wp_postmeta
    set meta_key = 'new_key_name'
    where meta_key = 'old_key_name'

Topic Closed

This topic has been closed to new replies.

About this Topic