Skip to main content
added 208 characters in body
Source Link

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 ?

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 :

global $post; 
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 ?

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 ?

Source Link

Delete Current Author Frontend user while delete custom post type

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 :

global $post; 
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 ?