Title: CPT DELETE when DELETE USER
Last modified: January 10, 2017

---

# CPT DELETE when DELETE USER

 *  Resolved [DenisCGN](https://wordpress.org/support/users/deniscgn/)
 * (@deniscgn)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/cpt-delete-when-delete-user/)
 * Hello,
 * where can I set my CPT that, when I delete a user the user posts will be deleted?
 * > **‘delete_with_user’**
   >  (bool) Whether to delete posts of this type when deleting
   > a user. If true, posts of this type belonging to the user will be moved to 
   > trash when then user is deleted. If false, posts of this type belonging to 
   > the user will *not* be trashed or deleted. If not set (the default), posts 
   > are trashed if post_type_supports(‘author’). Otherwise posts are not trashed
   > or deleted. Default null.
 * I cant find it in the settings.
 * Thanks,
    Denis

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [9 years, 6 months ago](https://wordpress.org/support/topic/cpt-delete-when-delete-user/#post-8636822)
 * Looks like a new enough parameter that we haven’t added support for it yet in
   CPTUI.
 * That said, you’re going to have to utilize this filter in the meantime: [https://github.com/WebDevStudios/custom-post-type-ui/blob/master/custom-post-type-ui.php#L435-L445](https://github.com/WebDevStudios/custom-post-type-ui/blob/master/custom-post-type-ui.php#L435-L445)
 * Just add the `delete_with_user` index to the passed in array for the callback
   and assign that index to true before returning back to the filter.
 * New enhancement issue regarding it: [https://github.com/WebDevStudios/custom-post-type-ui/issues/586](https://github.com/WebDevStudios/custom-post-type-ui/issues/586)
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [9 years, 6 months ago](https://wordpress.org/support/topic/cpt-delete-when-delete-user/#post-8636824)
 * Note we’re planning to have 1.5.0 out the door this week, but it’s too late to
   get this in for that version, so it’ll likely be 1.6.0 when this is provided 
   in the plugin by default.
 *  Thread Starter [DenisCGN](https://wordpress.org/support/users/deniscgn/)
 * (@deniscgn)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/cpt-delete-when-delete-user/#post-8640942)
 * Hello Michael,
 * first of all, thanks for your answer and adding it to an update.
 *     ```
       	if ( true === $yarpp ) {
       		$args['yarpp_support'] = $yarpp;
                       $args['delete_with_user'] = TRUE;
       	}
       ```
   
 * Should I put this into the code and add it to my functions.php page?
 * Cheers,
    Denis
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [9 years, 6 months ago](https://wordpress.org/support/topic/cpt-delete-when-delete-user/#post-8642545)
 * Oops, looks like you didn’t see the reply until after I merged 1.5.0 into the
   master branch.
 * [https://github.com/WebDevStudios/custom-post-type-ui/blob/master/custom-post-type-ui.php#L441-L451](https://github.com/WebDevStudios/custom-post-type-ui/blob/master/custom-post-type-ui.php#L441-L451)
 * Just something like this into your functions.php file:
 *     ```
       denis_cptui_delete_with_user( $args ) {
           $args['delete_with_user'] = true;
           return $args;
       }
       add_filter( 'cptui_pre_register_post_type', 'denis_cptui_delete_with_user' );
       ```
   
 *  Thread Starter [DenisCGN](https://wordpress.org/support/users/deniscgn/)
 * (@deniscgn)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/cpt-delete-when-delete-user/#post-8643110)
 * Hello Michael,
 * this works fine, thanks a lot.
 * Cheers,
    Denis

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘CPT DELETE when DELETE USER’ is closed to new replies.

 * ![](https://ps.w.org/custom-post-type-ui/assets/icon-256x256.png?rev=2744389)
 * [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-type-ui/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-ui/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-ui/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-ui/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-ui/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [DenisCGN](https://wordpress.org/support/users/deniscgn/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/cpt-delete-when-delete-user/#post-8643110)
 * Status: resolved