Skip to content

Commit 42d4279

Browse files
committed
remove: post meta associated with posts created for templates
1 parent 3cb65ef commit 42d4279

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

uninstall.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ function onedesign_plugin_deletion(): void {
2424
$brand_site_post_ids = get_option( 'onedesign_brand_site_post_ids', array() );
2525
if ( is_array( $brand_site_post_ids ) && ! empty( $brand_site_post_ids ) ) {
2626
foreach ( $brand_site_post_ids as $post_id ) {
27+
28+
// delete post meta associated with the post.
29+
$meta_keys = get_post_meta( $post_id );
30+
if ( is_array( $meta_keys ) && ! empty( $meta_keys ) ) {
31+
foreach ( $meta_keys as $meta_key => $meta_value ) {
32+
delete_post_meta( $post_id, $meta_key );
33+
}
34+
}
35+
2736
wp_delete_post( $post_id, true );
2837
}
2938
}

0 commit comments

Comments
 (0)