Last active
March 24, 2016 21:40
-
-
Save dotspencer/ba3e5572ab914f075c36 to your computer and use it in GitHub Desktop.
Create WordPress Admin Account Using FTP/PHP (and other iCORDS things)
This file contains hidden or 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
Create WordPress Admin Account Using FTP/PHP | |
April 25, 2012 | |
Here is a little snippet which can create a WordPress backend account with ease using the FTP, just paste this PHP snippet in the active theme’s functions.php and the account will be created. Also, make sure the username and the email are unique, or the function will fail. | |
function admin_account(){ | |
$user = 'AccountID'; | |
$pass = 'AccountPassword'; | |
$email = '[email protected]'; | |
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','admin_account'); | |
The above function creates an administrator account by default(which means full access to the website features), however, if you will like to create an account with lesser capabilities, you can try editor, author, contributor or subscriber(Learn roles and capabilities of each of these here). |
This file contains hidden or 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
In wp-config, add (or uncomment) this line before /* That's all, stop editing! Happy blogging. */ | |
This relocates the wp core to a new domain. Do this when migrating back to icordsgeo.org. | |
define('RELOCATE',true); | |
Source: | |
https://codex.wordpress.org/Changing_The_Site_URL#Relocate_method |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment