Last active
January 4, 2020 19:55
-
-
Save CabalTC/0d0c7a65b2d563f36a407b0a26043b6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin: crear usuario administrador | |
Donate link: https://www.paypal.me/davidolier | |
Description: Crear usuario administrador en WordPress via PHP | |
Author: David Olier | |
Author URI: https://davidolier.com/ | |
License: GPLv2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
add_action( 'init', 'do_admin_user' ); | |
function do_admin_user() { | |
$usuario = 'administrador'; | |
$password = 'contrasena'; | |
$direccion_email = 'admin@tuweb.com'; | |
if ( ! username_exists( $username ) ) { | |
$user_id = wp_create_user( $usuario, $password, $direccion_email ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment