I downloaded a WordPress website that I am modifying for a friend. He gave me access to cPanel, where I downloaded the SQL and changed it on XAMPP.

Now when I open >localhost/wp it opens the website but without the control panel.

I think to modify I need to access >localhost/wp/wp-admin but I don't have the username or password.

Do I have to ask him for it? Am I in the wrong path to modify the website?


As long as you know the username you can have WP automatically log you in. You might need to ask your friend what that is.

Check to see if you're logged in and if not, get user by login, set the current user along with the auth cookie then redirect to the ~~user's admin~~ url or edit user url to change the password.

Place this in the functions.php of the currently activated theme.

add_action( 'wp', 'automatic_login' );

function automatic_login() {

    $username = "Admin";


    if ( ! is_user_logged_in() && ! is_wp_error( $user = get_user_by( 'login', $username ) ) ) {

        // Clear any auth cookies

        // Log the user in
        wp_set_current_user( $user->ID );
        wp_set_auth_cookie( $user->ID );

        // Admin Dashboard
        // $redirect_to = user_admin_url();

        // Go directly to the Edit User page to change your password
        $redirect_to = get_edit_user_link( $user->ID ) . '#password';
        wp_safe_redirect( $redirect_to );

When you say downloaded, do you mean exported (using the all in one migration plugin or similar).

If so then yes, you need the username and password.

I'm not sure if you're talking about ssh.

  • I exported using phpadmin. I also got to modify a password via php admin so i could get in. The thing is, i have the website locally, and i know how to run it, but i dont know how to get in a page that allows me to modify, in localhost/wp/wp-admin it opens a page that doesnt allow me to modify the layout. Hope you can help me with this, thank you! – Stefano Pesce Jan 23 '16 at 1:29
  • ? Do you have a username and password that allows you to login via WordPress? If so you're good, if not you need a crack and I'm no expert at hacking into WordPress. – SeanJ Jan 23 '16 at 1:54

If you want to modify the page content, you need to ask the the password to your friend and login via localhost/wp/wp-admin. You can also create generate your own password and replace it in the database.

If you want to modify the website structure, you have to open {your_webstite_folder}/wp-content/themes/{theme_name} and you'll find here every files you need to modify the website.

However I strongly recommend you to create a child theme and modify the child theme only. https://www.elegantthemes.com/blog/resources/wordpress-child-theme-tutorial

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.