Access WordPress Admin Account via cPanel if Forgot

0

Hello, we are here with a new article that how we Access WordPress Admin Account via cPanel when we forgot the WordPress login information like User Name and Password. We widely welcome all WordPress lovers to this article.

When you want to login to your WordPress admin panel, you must enter your account username and password in the WordPress login form. Sometimes you may have forgotten your username or password in WordPress, in this case, you cannot log in to your WordPress admin panel. So what can you do to access your WordPress admin panel? Don’t worry we will guide you in this structure with illustration how to solve this problem just follow the steps.

WordPress User Account

Typically, WordPress provides you with the option that if you forget your password, you can solve your password forgetting problem by email.

Access WordPress Admin Account

But sometimes you may forget your email or you cannot access email for any reason and cannot reset your password via email! So what to do now? And How to access the WordPress admin panel?

Access to Hosting Panel (cPanel)

You can easily solve this problem by accessing you site cPanel, which you have Hosted WordPress files. In this article, we will teach you how to create an Administrator account in WordPress through cPanel.

Create an account on WordPress via (cPanel)

To create an account in WordPress via the Cpanel, you must first click on the public_html that is your root directory, as shown below. Public_html is the root of your site that has the entire WordPress file.

Access WordPress Admin Account

By clicking Public_html, we can access all WordPress folders as shown below.

Access WordPress Admin Account

There are few codes for creating WordPress account that we need to write on function.php file, to access Fuction.php we need to click on the wp-content folder.

By Clicking on WP_Content folder like the picture below we should click on the activated theme folder.

Access WordPress Admin Account

By clicking on the themes folder as shown below. You can see the folder associated with the list of installed them in your WordPress.

Access WordPress Admin Account

The folder for the theme which is currently active on your site should be selected, for example, we assume that the Twenty-fifteen theme is active on the site. We select the folder for the Twenty-fifteen theme. In the folder for each WordPress theme, there is a file named function.php and you can write the code for creating the account in WordPress.

Access WordPress Admin Account

You must copy the following code to create a new account in the function.php file of your site’s theme. In the following codes, you must specify your username and password and your email so that your account can be created according to your username and password.Note that if you only specify a username and password without entering an email, your account will be created.

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');

Be careful that when you create your WordPress user account with the username and password after you’ve successfully accessed in your WordPress admin panel, you need to clear the codes in the function.php file to keep it safe.

Clearing these codes will not create a problem since the default username and password you created in your code have been created in your database and you can still log in to the WordPress admin panel with your new account username and password.

I hope the content of this article will be useful to you.

Don’t Forget to Check: WordPress Reset Password or Recovery

Leave A Reply

Your email address will not be published.