Can't Access a Wp-Admin Page
What to do if I can't access the wp-admin page and log in to my WordPress website?
If you can’t open the WordPress login page but see a 404 or another error instead, there can be several reasons for that. So, there are a few things to check and a few solutions to fix this problem.
Check your Firewall
Some firewalls block the login page, so disable your firewall and try again.
Clear Cache and Cookies
This method is useful when you can’t log in (not when the login page is unavailable), but before doing any other actions, it’s better to do this anyway.
Your Security Plugin Caused the Problem
There are two most frequent problems with the login page caused by such plugins:
A temporary block
You are blocked because you exceeded the maximum number of login attempts set by the security plugin when entering the wrong login or/and password. The first solution is to wait because such blocks are temporary.
The second solution is deactivating the plugin via FTP or the hosting file manager. Go to wp-content > plugins > {your security plugin folder} and rename it. The simple way to do this is to add -old to the folder’s name. It will automatically deactivate the plugin. Try to log in again (it might also be helpful to clear your browser cache before doing it).
After the successful login, don’t forget to rename the plugin folder back.
The login URL has been changed
Changing the default login URL to the custom one is a good security practice because it helps to hide it and protect the website from hackers and bots. It looks like yourwebsite.com/customURL instead of yourwebsite.com/wp-admin.
But this unique URL is quite simple to forget. In this case, use the instructions from the previous paragraph: using an FTP client or hosting file manager, renaming the plugin’s folder responsible for the URL change, and logging in using the default yoursite.com/wp-admin link.
If you don’t know which plugin has caused this problem, you can deactivate all the plugins via FTP. To do this, go to {yoursite.com} > wp-content and rename the plugins folder.
Don’t forget to rename them back after you have logged in successfully.
Your Theme Caused the Problem
If your theme has compatibility issues with the new WordPress version or something else has happened with it, it can also cause problems with accessing the login page. To fix this issue, deactivate the theme via FTP by renaming its folder, just as described in the previous paragraphs for plugins.
There is a 500 Internal Server Error or a White Screen of Death
There can be several reasons for such errors. But the most frequent is insufficient memory. To fix it, edit the wp-config.php file via FTP. Find the WP_MEMORY_LIMIT line and change it to the bigger value. For example, if you have 128M, change it to 256M.
define('WP_MEMORY_LIMIT', '256M');
Another frequent reason is a problem with the .htaccess file. To fix it, go to your website root, find the .htaccess file, and back it up (save it on your computer). After that, delete the file from the website folder. Try to log in to the website after doing that. If you did, don’t forget to regenerate the new .htaccess file. To do it, go to Settings > Permalinks and simply click “Save.”
PHP Errors
If you see a white screen and a PHP error message and cannot access the login page, you probably have made some edits to one of the PHP files (as a rule to functions.php), but there’s a mistake in a code.
PHP error messages always (unless you have manually disabled it) give the information where the mistake is: the file with the full path and the line number. So it’s easy to find and fix it.
Use an FTP client or a file manager on the hosting panel, open the file the error message is pointing to, and fix the error. In most cases, all you need to do is simply delete the code snippet you’ve recently added (which has actually caused this error), so it will not take much time. If it doesn’t help and you are not good in PHP, and can’t figure out how to fix the syntax mistake, find the same file in your recent backup archive and copy and paste the code from that working version.
A Problem with the File Permission
Due to different reasons, the file permission problem may occur. To fix it, open the FTP client and connect to your website. Find the wp-login.php file, right-click on it and select the “File permissions” option. Make sure that the numeric value is 644.
Also, check the permissions for the wp-admin folder and ensure the value is 755.
The Website URL Has Been Changed
The website URL can be changed via the admin dashboard in Settings > General, and sometimes the admin can accidentally change it to the wrong or non-existing one. In this case, the URL will look like anothersite.com/wp-admin instead of yourwebsite.com/wp-admin.
There are three methods to fix it.
- Edit the database. First, back up the database and save it on your computer. Log in to phpMyAdmin and find the wp-options table there. In that table, find siteurl and home records. Click the “Edit field” button and change that record’s value to your website’s correct URL. Do it for both records. Save changes.
It’s the most optimal method of fixing the website URL.
- Edit the functions.php file via FTP. Go to {yoursite.com} > wp-content > functions.php and add those lines right after the first <php
update_option( 'siteurl', 'https://yoursite.com' );
update_option( 'home', 'https://yoursite.com' );
replacing the “https://yoursite.com” with the proper URL of your website.
Go to the login page (it can also be helpful to clear your browser cache before doing it). Note that you should remove those lines of code after successfully logging in to your website and fixing the mistakes in Settings.
- The hard-coding method. Change the wp-config.php file (accessing it via FTP, too).
Find the line:
/* That's all, stop editing! Happy publishing. */
And insert the following lines of code just above it:
define('WP_HOME','https://yoursite.com');
define('WP_SITEURL','https://yoursite.com');
replacing the “https://yoursite.com” with the proper URL of your website.
It’s important to note that after adding those lines, you will not be able to modify the website URL from the dashboard; also, it can cause some difficulties if you move to another domain.
Restore the Website from a Backup
If none of the methods work for you, restore the website from the recent backup made by your hosting provider.