If you will delete the custom posts, if you kill a user, then hook inside the delete_user Hook. This hook give you the possibility to call actions and doing other jobs, like delete posts to this user id.
See the codex for more information and a example source.
I use custom posts on my site and once the user is deleted all their custom posts also go.
Are you sure that in your code that the user ID is the correct author for those posts – depending on how it is coded the author can end up being the administrator. I have seen before with custom post moderation that the author is actually stored as a separate meta tag but wordpress thinks the author is actually the admin that approved it.
It depends on how your theme has been written and how other functions on your website work.
I would recommend having a look at one of these custom posts to make sure who the registered author is, if it is different you will need to put some sort of post query in the delete_user hook as suggested by @bueltge and delete the found posts with author meta tag == user
1) Your post types that you want to delete, they must have an active field for the author (register_post_type -> supports -> author).
If you will delete the custom posts, if you kill a user, then hook inside the
delete_user
Hook. This hook give you the possibility to call actions and doing other jobs, like delete posts to this user id.See the codex for more information and a example source.
I use custom posts on my site and once the user is deleted all their custom posts also go.
Are you sure that in your code that the user ID is the correct author for those posts – depending on how it is coded the author can end up being the administrator. I have seen before with custom post moderation that the author is actually stored as a separate meta tag but wordpress thinks the author is actually the admin that approved it.
It depends on how your theme has been written and how other functions on your website work.
I would recommend having a look at one of these custom posts to make sure who the registered author is, if it is different you will need to put some sort of post query in the
delete_user
hook as suggested by @bueltge and delete the found posts with author meta tag == user1) Your post types that you want to delete, they must have an active field for the author (register_post_type -> supports -> author).
2) Or you can use the post_types_to_delete_with_user filter, see:
I add an answer for those who like me pass here and not found a solution.
Do not write:
Instead do not forget the
s
: