i need to Delete wp_terms -> name field when a user is delete .
my requirement is admin needs to assign posts to specific users, that is admin need to add a post to user1 ,but user2 should not see that.for this i created a custom post and add taxonomy for that.And the terms are users Usernames .so i need to list the usernames of the users as terms in the taxonomy.when a new user is registered his username should updated in the wp_terms table also,so i will get the usernames as terms. this is working well ,now i need to delete the term from taxonomy when the user is removed.
i stucked here .please suggest some solution for this
what i have done is
add_action( 'delete_user', 'yg_user_delete', 10, 1 );
function yg_user_delete( $user_id ) {
$user_info = get_userdata($user_id); $user_name = $user_info->user_login;
wp_delete_term( $user_name, 'user1', array() );
}
here 'user1' is my taxonomy