I created custom post type using Toolset. I want to delete current post author ( front-end user ) when i delete the post.
I tried below code :
add_action('before_delete_post', 'my_deleted_post');
function my_deleted_post($post_id){
global $post;
if ($post->post_type == "agency") {
//echo $post->post_author;exit;
require_once(ABSPATH.'wp-admin/includes/user.php' );
wp_delete_user( intval($post->post_author) );
}
}
But it is not working to me can anyone help me here ?