WordPress.org

Support

Support » How-To and Troubleshooting » Move value from one meta key to another

Move value from one meta key to another

  • 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”

    Thanks.

Viewing 1 replies (of 1 total)
  • 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'
Viewing 1 replies (of 1 total)
  • The topic ‘Move value from one meta key to another’ is closed to new replies.
Skip to toolbar