在Wordpress中创建用户后触发操作

In a Wordpress site I need to create a custom post every time a user is created. In this post I will have an administrator adding private files to the user. I need to trigger a function that inserts a custom post after the user is created. This is the function:

function user_after_creation( $user_id ){
    $user = get_user_by( 'id', $user_id );
    $post_setup = array(
        'post_type'     => 'private_user_page',
        'post_title'    => $user->user_login,
        'post_name'     => $user->user_login,
        'post_status'   => 'publish',
        'post_excerpt'  => ''
    );
    wp_insert_post( $post_setup );
}

Well, I was thinking of something like this:

add_action( 'user_register', 'user_after_creation', 10, 1 );

to trigger the action, someone else suggested:

do_action( 'user_register', user_after_creation( $wpdb->insert_id ) );

But i am not really sure of what to do.

Take a look at user_register. It is called when a user account in first registered/created and passes the user id. Should meet your needs.