Ciao @cicccio997 ,
ho trovato nel pc un file di testo con la spiegazione necessaria ad aggiungere un nuovo amministratore.
Lo inserisco ne post qui sotto. Naturalmente visto che sei in ambito XAMPP non hai nessuna necessità di un collegamento FTP ma puoi editare direttamente il file necessario. Meglio prendere nota di come era la funzione editata prima di farlo perché andrà ripristinata.
Fammi sapere come va. Se funziona con l’ultima versione di wp. Non ho mai usato questo sitema veramente, non so se la funzione esiste e va modificata o se bisogna aggiungerla ex novo. Insomma vediamo.
Adding an Admin User in WordPress Using FTP
First thing you will need is an FTP client. If you are new to using FTP, then see our guide on how to use FTP to upload files in WordPress.
Once connected to your WordPress site, you need to locate your WordPress theme’s functions.php file.
It would be at a location like this:
/yoursite.com/wp-content/themes/your-current-theme/functions.php
Right click on functions.php file and then select download.
Your FTP client will download the functions.php file to your computer.
Downloading functions.php file to edit
function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = 'email@domain.com';
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','wpb_admin_account');
Don’t forget to replace Username, Password, and email@domain.com with your own values.
Next, save the file and then upload it back to your website using the FTP client.
You can now visit your WordPress site’s login area and sign in with the user account you just added.
Once you have logged in to your WordPress site, please edit the functions.php file and delete the code you added. Deleting the code will not remove the user you added, and you can always add new users and authors to your WordPress site.
Un saluto!
Ok funziona. Ho provato su un sito wp installato in XAMPP.
Dunque:
- Con un editor di testi (notepad o simile) apri il file /wp-content/themes/your-current-theme/functions.php
- Aggiungi questo codice alla fine del file:
function wpb_admin_account(){
$user = 'pippo9';
$pass = 'p2426TPaly';
$email = 'pippo9@tuodominio.it';
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','wpb_admin_account');
Accedi alla dashboard del sito con le credenziali: user: pippo9 password: p2426TPaly
Ricordati di cancellare il codice che è stato aggiunto. Non serve più.
Ciao.
Chi ha creato la discussione
cicccio997
(@cicccio997)
Ho risolto alcuni problemi sul database. Era troppo grande e non importava tutte le cartelle. Ho aumentato la memoria e funziona
-
Questa risposta è stata modificata 1 settimana, 1 giorno fa da
cicccio997.