Skip to content

Commit 7d86e1b

Browse files
committed
Add optional --skip-email flag to 'user update'
1 parent 334ec3d commit 7d86e1b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/User_Command.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ public function create( $args, $assoc_args ) {
481481
* --<field>=<value>
482482
* : One or more fields to update. For accepted fields, see wp_update_user().
483483
*
484+
* [--skip-email]
485+
* : Don't send an email notification to the user.
486+
*
484487
* ## EXAMPLES
485488
*
486489
* # Update user
@@ -498,6 +501,11 @@ public function update( $args, $assoc_args ) {
498501
$user_ids[] = $user->ID;
499502
}
500503

504+
if ( isset( $assoc_args['skip-email'] ) ) {
505+
add_filter( 'send_email_change_email', '__return_false' );
506+
add_filter( 'send_password_change_email', '__return_false' );
507+
}
508+
501509
$assoc_args = wp_slash( $assoc_args );
502510
parent::_update( $user_ids, $assoc_args, 'wp_update_user' );
503511
}

0 commit comments

Comments
 (0)