Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Função para criar usuário administrador no WordPress via FTP
/**
*
* Função para criar usuário administrador no WordPress via FTP
*
* @since 17/04/2018
* @see https://brasa.art.br/como-adicionar-um-usuario-no-wordpress-pelo-ftp/
* @return void
*
*/
function user_by_ftp(){
$user = 'ketchup';
$pass = 'S9XJQjc2*u!D';
$email = 'email@ketchup.com.br';
if ( ! username_exists( $user ) && ! email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
}
}
add_action( 'init','user_by_ftp' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment