$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Unknown Post Meta Records|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Unknown Post Meta Records

matteradmin8PV0评论

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.

Share Improve this question edited Jan 30, 2019 at 21:39 TechTurtle2 asked Jan 28, 2019 at 21:41 TechTurtle2TechTurtle2 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

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' );

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far