I inherited a site that has had many developers. There are post meta custom post type records for custom post types that we do not have. They appear to have come in through an import when the site was rebuilt in a new host and new theme. Is there a way to remove records in post meta that don't tie to any of our software without breaking the Wordpress Core?
Additional Information Update The records in the postmeta table are tied to active posts and pages. The values in the records are irrelevant to the current site.
I inherited a site that has had many developers. There are post meta custom post type records for custom post types that we do not have. They appear to have come in through an import when the site was rebuilt in a new host and new theme. Is there a way to remove records in post meta that don't tie to any of our software without breaking the Wordpress Core?
Additional Information Update The records in the postmeta table are tied to active posts and pages. The values in the records are irrelevant to the current site.
you can achieve this in 2 step
First Step : Remove ORPHANED UNUSED post meta data (SQL Query)
DELETE pm FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
Second Step INFORMATION : Identify all post meta which is currently set to that post
$meta_values = get_post_meta( get_the_ID() );
echo '<pre>'. print_r($meta_values, 1). '</pre>';
if you found any extra meta, which is not used by your system you can delete it.
delete_post_meta( $post->ID, 'custom_key' );