When I delete a bunch of posts their custom fields remain in the database, is there a way to remove them as well on deletion?
Leave a Reply
You must be logged in to post a comment.
When I delete a bunch of posts their custom fields remain in the database, is there a way to remove them as well on deletion?
You must be logged in to post a comment.
The best way to do this is to use the wp_delete_post function as follows:
This function accounts for comments, term_relationships, posts.post_parent, and postmeta.