I'm deleting WP users with wp_delete_user(). It works well. I noticed when I manually delete a user in the WP Admin it asks first to "Delete all content" or "Attribute all content to: ".
I want to delete all content associated with the user. We're running some plugins that seem to have a bunch of user meta data in wp_postmeta I think. I'm assuming this is what its referring too.
Anyway, I need to make sure wp_delete_user() is, in fact, actually removing all user content too and not leaving it in there. Can anyone confirm this? Does wp_delete_user() delete all user content as if I selected "Delete all content" in the WP admin manually?
Thanks.
I'm deleting WP users with wp_delete_user(). It works well. I noticed when I manually delete a user in the WP Admin it asks first to "Delete all content" or "Attribute all content to: ".
I want to delete all content associated with the user. We're running some plugins that seem to have a bunch of user meta data in wp_postmeta I think. I'm assuming this is what its referring too.
Anyway, I need to make sure wp_delete_user() is, in fact, actually removing all user content too and not leaving it in there. Can anyone confirm this? Does wp_delete_user() delete all user content as if I selected "Delete all content" in the WP admin manually?
Thanks.
Share Improve this question asked May 8, 2017 at 20:28 Ken WilliamsKen Williams 1111 silver badge2 bronze badges2 Answers
Reset to default 2Check the docs.
wp_delete_user( $id, $reassign );
If the $reassign parameter is not assigned to a User ID, then all posts will be deleted of that user. The action 'delete_user' that is passed the User ID being deleted will be run after the posts are either reassigned or deleted. The user meta will also be deleted that are for that User ID.
I can confirm that not all contents will be deleted, yes the attachment (maybe also post) will be deleted, but another post types is no, including post revision and page (invisible on admin but actually still on database)
To make sure, you will need to manually iterate and delete them with wp_delete_post()
before you use the wp_delete_user()
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742335561a4424578.html
评论列表(0条)