admin管理员组文章数量:1130349
I have a custom function in my plugin, I want to run it when any of the wordpress user is deleted so i can know that a user and which user was deleted. I implemented this but it is'nt working.
function my_delete_user( $user_id ) {
global $wpdb;
require_once(ABSPATH.'wp-admin/includes/user.php' );
$user_obj = get_userdata( $user_id );
$email = $user_obj->user_email;
$headers = 'From: ' . get_bloginfo( "name" ) . ' <' . get_bloginfo( "admin_email" ) . '>' . "\r\n";
wp_mail( $email, 'You are being deleted, brah', 'Your account at ' . get_bloginfo("name") . ' is being deleted right now.', $headers );
}
add_action( 'delete_user', 'my_delete_user' );
but this is not working, as it should send a mail. I want to know which user was deleted from their email.
I have a custom function in my plugin, I want to run it when any of the wordpress user is deleted so i can know that a user and which user was deleted. I implemented this but it is'nt working.
function my_delete_user( $user_id ) {
global $wpdb;
require_once(ABSPATH.'wp-admin/includes/user.php' );
$user_obj = get_userdata( $user_id );
$email = $user_obj->user_email;
$headers = 'From: ' . get_bloginfo( "name" ) . ' <' . get_bloginfo( "admin_email" ) . '>' . "\r\n";
wp_mail( $email, 'You are being deleted, brah', 'Your account at ' . get_bloginfo("name") . ' is being deleted right now.', $headers );
}
add_action( 'delete_user', 'my_delete_user' );
but this is not working, as it should send a mail. I want to know which user was deleted from their email.
本文标签: How do I run my custom function in my plugin when a wordpress user is deleted
版权声明:本文标题:How do I run my custom function in my plugin when a wordpress user is deleted? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749023255a2304701.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论