I have 3000 posts with that custom field name ‘refer’ and i need to change it to ‘ref’ for theme needs, instead of doing it manually i need a query or technique to change them all.

Question 1
I am trying to rename a custom field, from ‘refer’ to ref. what is the query needed to rename a custom filed. it would be better if its done using function.php(instead of doing in phpmyadmin).

Question 2
I also have a lot of unwanted custom fields which are need to be deleted, how should i go about. help me out guys.

3 s
3

I found the answer

UPDATE `wp_postmeta` SET `meta_key` = 'ref' WHERE `meta_key` = 'refer'

use this part in your SQL

Reference

Leave a Reply

Your email address will not be published. Required fields are marked *