How to Fix WordPress Posts Returning 404 Errors

Share on facebook
Share on twitter
Share on email

Every site owner encounters the dreaded 404 error at some point. The bug is usually the result of a small conflict somewhere. Most solutions are relatively simple, even for inexperienced administrators. This guide looks at the common triggers and how to fix WordPress posts returning 404 errors. Let’s begin by looking at the typical causes.

It’s wise not to do anything the first time you come across a WordPress 404 error. That’s because it could be a temporary issue caused by the site’s web hosting provider. Do a complete page refresh (CTRL + F5) a few times over the next couple of hours if necessary. If the problem seems permanent, continue to the troubleshooting and solutions below.

Common Causes of the 404 Error Message

The 3 common causes of 404 page not found errors are:

  1. WordPress permalinks
  2. .htaccess file
  3. WordPress themes and plugins (least likely)

Let’s go over each of these in order of probability, with the most common first.

#1 404 Errors Caused by WP Permalinks

The 404 error is usually post-specific rather than site-wide. That means the login to your WP admin area shouldn’t be affected. The error suggests the post or page has somehow disappeared. Don’t worry; nothing is lost in WordPress, only from the front end.

The first stop on your troubleshooting trail is at the site’s permalinks screen.

Log in to the WP Dashboard (skip to #2 if you can't access your Admin Area).

Go to Settings => Permalinks from the Dashboard side menu.

All you need to do on the Permalink Settings screen is scroll to the bottom and click Save Changes. This simple action flushes rewrite rules and updates your saved permalink settings.

Refresh the post URL (CTRL + F5) to see if it’s resolved the issue. This simple fix succeeds for the most part, but if it hasn’t worked for you, move to the next fix.

#2 404 Errors Caused by .htaccess files

We need to edit the .htaccess file if the above fix failed, or if you can’t access your Admin Area. You can access your .htaccess file via cPanel’s File Manager or FTP, but the steps are the same either way. We’re going to your blog or website’s cPanel File Manager for this guide.

Please see What Is cPanel, a guide for beginners, if you’re unfamiliar with cPanel.

Try the following if you have access to your WP Admin Area but the permalinks fix failed.

Log in to your WP website’s cPanel account.

Click the File Manager icon from the FILES box.

Your cPanel opens File Manager in a new tab.

Click the public_html directory (folder) in the left-side column.

Right-click on the .htaccess file in the right-side column

Select Change Permissions.

Tick (check) all boxes in the Write row to change the permissions from 644 to 666.

Click Change Permissions to save the changes.

Now return to your WordPress Permalink Settings screen and click Save Changes again.  

You must change your .htaccess file permissions back to 644 whatever the result.

Right-click on the .htaccess file in the right-side column

Select Change Permissions.

Untick (uncheck) the Group and World boxes in the Write row. This action changes the file permissions from 666 back to 644.

Click Change Permissions to store the changes.

No Access to the WordPress admin area

Note: Save a copy (backup) of your .htaccess file before you start.

This action is the most drastic. It removes all previously saved changes to your permalink structure. That means you’ll have to reset your WP permalinks manually afterwards.

From File Manager, click the public_html directory (folder) in the left-side column.

Right-click on the .htaccess file in the right-side column

Select Edit from the pop-up menu.

The file opens in a new tab in Edit mode.

Delete the content in the .htaccess file. Replace it with the WordPress default code rules below.

 # BEGIN WordPress

 RewriteEngine On

 RewriteBase /

 RewriteRule ^index\.php$ – [L]

 RewriteCond %{REQUEST_FILENAME} !-f

 RewriteCond %{REQUEST_FILENAME} !-d

 RewriteRule . /index.php [L]

 # END WordPress

 

Your .htaccess file should now look like the image below:

Click Save Changes (top right).

You should now be able to access your WordPress Admin Area. Remember to go in and manually reset all your WP custom permalinks to how you like them.

#3 404 Errors Caused by WP Themes & Plugins

Sometimes, 404 errors occur because of conflicts caused by WP themes and plugins messing with URL structures. The way to troubleshoot is to deactivate plugins and themes until you find the offending software. The best approach is from the WP Dashboard. If you can’t access your WordPress Admin Area, you can use FTP or the cPanel File Manager instead.

Please see How to Deactivate All Plugins When Not Able to Access the Dashboard for details.

Share on facebook
Share on twitter
Share on email

Subscribe to my newsletter

Subscribers to my newsletter get all the latest news, reviews, advice and gossip in the world of search engines, internet marketing, self-publishing, and North Wales (where I live). You can sign up for my free newsletter by clicking this link.

My Books

I have a range of webmaster related books for sale on Amazon in both Kindle and Paperback formats. WordPress, SEO & Self-Publishing.
On Amazon

My Online Courses

My courses cover a range of webmaster related skills, from learning WordPress itself, to installing an SSL certificate on your site.
On Udemy

Comments

Hello, I'm
Andy Williams!

You can get up to 90% off my Online Courses for webmasters, marketers & affiliates (plus a free course on Gutenberg).

Get my newsletter
delivered to your inbox

18748

We respect your privacy

18749