Being WordPress Developers ourselves, we understand that time is money…all the time. As most developers, we often save and re-use portions of code from one project to another, customizing or change snippets as need be.
For example, there is no reason to re-type line after line of code to create a custom post type when you can highlight a section of your old code and paste it in to your new project, saving you an enormous amount of time.
What can easily happen when re-using portions of your code is your old custom meta from your custom post type can be populated in to your new project. If you begin to work with posts/pages and you haven’t either removed or renamed the old meta, all of the old meta will appear as viable options for your client.
There is an easy SQL query you can run to clean this up if you’re comfortable with running SQL queries:
("DELETE FROM 'wp_postmeta' WHERE meta_value=''")
You may not feel comfortable running SQL queries so what we created was a simple WordPress plugin that will do the job for you. All you have to do is install the plugin and then access its options page under the Settings tab. From there, click on Clear Post Meta and you’ll see an input field. Type in YES in the input field and press the button. Simple as that and any custom post meta that is currently empty will be removed from the database.
Hope you enjoy our little addition to the WordPress world and let us know if you have any questions or run in to any issues at all!