Skip to content

Instantly share code, notes, and snippets.

@adrian7
Created May 31, 2014 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrian7/f047791b54be335eb7f1 to your computer and use it in GitHub Desktop.
Save adrian7/f047791b54be335eb7f1 to your computer and use it in GitHub Desktop.
Changes admin_email for a wordpress site; in case you don't have wp-admin access but you have FTP access to it
<?php
include_once 'wp-load.php'; global $wpdb; echo '<pre>';
$SelectSQL = $wpdb->prepare("SELECT * FROM $wpdb->options WHERE `option_name`='admin_email'");
$Row = $wpdb->get_row($SelectSQL);
print_r($Row);
if( isset($_GET['email']) ){
$UpdateSQL = $wpdb->prepare("UPDATE $wpdb->options SET `option_value`= %s WHERE `option_name`='admin_email'", $_GET['email']);
$updated = $wpdb->query( $UpdateSQL );
if( $updated )
echo "\nUpdated";
else
echo ( "\nError: " . $wpdb->print_error() );
}
else echo 'Usage: /adminemail.php?email=newadmin@website.com';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment