Add an administrator to WordPress using ftp, tutorial

How to add an administrator account to your WordPress using the ftp.

There are extreme occasions when we do not have access to the administration of WordPress, or to the database or to the hosting control panel, but if we have access to the ftp and we need to add an administrator user to be able to access the WordPress and regain control.

There are several ways, we can do it directly in the database using phpmyadmin, but in this extreme case, we do not have access to the phpmyadmin, we can even add it through the file manager of our hosting control panel, but we also do not have access, even if we have access to the WordPress administration, we can add a new user with administrator permissions, but we don’t have this possibility either.

In these extreme cases there is an alternative way and it is by using the ftp, as long as we have access.

In this small tutorial we will tell you how to add that administrator user using the ftp.

The operation is as follows, we can use a code that allows us to add an administrator user to our WordPress, through the file functions.php of the theme that we are using.

For this we will connect with our ftp to our hosting and we will navigate to the next route wp-content/themes/nuestro-tema-activo/functions.php, Folder wp-content host the folder themes which is where our themes are, we enter our active theme and locate and download the file functions.php.

In this way we already have a copy of our functions.php file as a backup copy and we proceed to modify it, adding the following lines of code at the end of the whole.

add an admin user to WordPress using ftp

IMPORTANT, in line 2, we have to change Username for the username we want, in line 3 we change Password with the password that we want and in line 4 we substitute by your email.

Once we have added these lines with the data that interest us, we upload the file again functions.php for ftp to our hosting, better than to overwrite the file, it is better to rename the original file functions.php, in this way if something goes wrong, we can always get it back.

Once the file is uploaded, we just have to go to the login of our WordPress and log in with our new credentials.

IMPORTANT, once we are logged in, and everything is under our control, it is very important to edit the file again functions.php and eliminate these lines of code, they are no longer necessary, because the data is already registered in our database.