How to Fix Posts Returning 404 Error for Your WordPress Website?

The WordPress 404 error is one of the most common bugs you’ll run across online. However, that doesn’t make it any less annoying or harmful when it appears on your own website. The good news is that fixing a WordPress post returning a 404 error is relatively simple. Even the process is well-documented for WordPress websites. Let’s now take a deep dive into how to fix posts returning 404 errors in WordPress along with the various aspects and causes of this issue.

In this article, we’re going to walk you through three ways you can tackle the 404 error:

  • Resetting Your WordPress Permalinks
  • Restoring Your .htaccess File
  • Disabling Your Themes & Plugins

Before we roll up our sleeves let’s find out how the 404 error works and what are the common causes. 

What Does 404 Error Actually Mean?

Posts returning 404 error pops up on your WordPress post when you try to access a page and your browser can’t find or fix it.

Basically, it means that the client (your or your visitor’s web browser) was able to successfully connect to the host (your website’s server), but it was unable to fetch the actual resource which could be a specific URL or filename.

For example, someone tries to visit and you don’t have any content with the slug post-name. The visitor will then see 404 error on WordPress. 

It’s not just posts or pages but any asset, such as a missing image file, missing JavaScript, missing CSS, can generate a 404 error on the server.

What Causes Posts Returning 404 Error on WordPress?

If you see this error on all of your site’s content, it’s typically due to an issue with your WordPress site’s permalinks. If you only see it on individual pieces of content, it’s most likely because you changed a piece of content’s slug without setting up a redirect.

Additionally, the 404 error isn’t always a bad thing – it’s only bad when it’s interfering with usability. And sometimes things are just out of your control!

For example, sometimes a person might just type the wrong URL in their address bar. In that case, they’ll still see a 404 error, but there’s no actual problem with how your site is configured. You can create your own custom 404 page to help get visitors to the right spot (we’ll show you how later on).

404 Error Not Found Variations on WordPress

Because different browsers display error messages differently, you might see a different message for this error. Other common variations include:

  • “Error 404”
  • “404 Not Found”
  • “HTTP Error 404”
  • “Not Found”
  • “Page Not Found”
  • “The requested URL was not found on this server.”
  • “The page cannot be found”
  • “We can’t find the page you’re looking for.”
  • “The requested URL /~ was not found on this server. That’s all we know.
404 error showing on chrome browser

How to Fix Posts Returning 404 Error? (3 Methods)

In some cases, WordPress “page not found” errors soon disappear on their own. This typically happens if they are caused by an error with your web hosting provider. Before starting any serious troubleshooting, we recommend that you try force-refreshing your website, after giving it five or ten minutes to sort itself out.

If the error persists for longer than that, it’s reasonable to assume that there’s an underlying issue with your website. In that case, let’s run through three potential solutions, one by one.

One of the most common causes of the WordPress 404 error is a problem with the way WordPress generates your permalinks. As you may know, WordPress provides you with several options for formatting your posts and pages’ links.

For example, you can configure the platform to use plain numeric links, or set each post’s name as its URL:

permalink settings to avoid returning 404 error on wordpress posts

In any case, the first thing you’ll want to do when you run into a 404 error on a WordPress post is to reset your permalinks. There are two ways to do this, one through your dashboard and another via FTP. If you have access to your dashboard, you’ll want to follow the rest of the instructions in this section.

Otherwise, you should skip down to method number two.

  • If you can get into your dashboard, start by navigating to your Settings › Permalinks tab. 
  • Once you’re in, you’ll want to take note of which structure your site is using at the moment. 
  • You’ll need to change it temporarily in order to reset WordPress’ permalink settings, but you’ll change it back in a moment.
  • For now, select the Plain option under Common Settings, and click on the Save button at the bottom of the page.
  • The page will reload. Then you can go ahead and choose your previous permalink type, and save your changes once more. 

That’s all it takes to reset your WordPress permalink structure.

Now, go ahead and try to browse your website as you would normally. Check out the pages that returned the errors before, if it fixed posts returning 404 error. If the error is gone, then pat yourself on the back – it only took you one shot to fix it!

Restore Your WordPress .htaccess File

When you make changes to your WordPress permalink structure, they get saved to a file called .htaccess. That particular file governs how WordPress interacts with its server, as well as the way it generates URLs for your pages.

If you don’t have access to your dashboard due to the 404 error, you’ll need to edit .htaccess manually to reset your permalinks. 

  • First, access your website via FTP and navigate to your WordPress root folder. Here’s a guide you might want to check out to know how to use FTP to upload files to WordPress.
  • This is the directory that contains your WordPress installation, and it’s commonly located in a folder called public_html or www, or is named after your website:
root folder in wordpress
  • Open that folder now, and look for the .htaccess file within. 
  • If you’re using FileZilla, you’ll want to right-click on the .htaccess file and select the option that says View/Edit. What this does is download a copy of the file to your computer, and open it using your local default text editor. Now, you’ll be able to make any changes you want to do.
  • If you don’t understand what all the code in this file does, don’t worry. You shouldn’t make any changes to it unless you’re sure about them anyway. 
  • However, what you can do is use the default WordPress .htaccess code, which looks like this:

HTAccess File

             # BEGIN WordPress
          <IfModule mod_rewrite.c>
          RewriteEngine On
          RewriteBase /
          RewriteRule ^index\.php$ - [L]
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule . /index.php [L]
             # END WordPress
  • That’s a bare .htaccess file, with no modifications to it. That means it will remove any changes made to your permalink structure. 
  • Go ahead and backup the contents of your old .htaccess file now, and replace them with the code snippet above.
  • After that, save the changes to your .htaccess file using your text editor and close it. 
  • FileZilla will ask if you want to replace your existing .htaccess file with the copy you just edited. 
  • Agree with the prompt, and that’s it! You just reset your WordPress permalinks manually, without breaking anything in the process.
  • At this point, go ahead and try to access WordPress again. This can fix post returning 404 error. 
  • However, you’ll still want to put your permalink structure back to the way it was before unless you like numeric URLs for your posts.
  • Remember, you can change the way your permalinks look by going into your dashboard and navigating to the Settings › Permalinks tab. 
  • Once you’re in, just choose the structure your website used before the whole 404 debacle started, and save your changes. This should fix posts returning 404 error and everything should be back to normal.

Disable Your WordPress Themes & Plugins

As we mentioned earlier, sometimes your plugins and themes can affect your WordPress URL structure, depending on their settings. If you tried one or both of the previous methods and the WordPress 404 error still persists, disabling your themes and plugins is your best bet.

Plugins are not only responsible for 404 error, if there are any corrupted or broken plugins you will very likely come across “Too many Redirects error”. One of the ways to fix that error is to disable plugins. To know more about this error and how to fix it, check out our detailed guide on how to fix too many redirects.

Disable Your Themes

If you’ve checked all your plugins and none of them is to blame, you’ll also want to make sure your active theme isn’t behind the 404 error. This process is much faster since you only have to check one theme. Go to your Themes tab and switch your active theme to anything else.

  • Now, check to see if the WordPress 404 error is gone. 
  • If it is, then you again have to choose between looking for an update or finding a new theme.

When you find and disable the theme that is responsible for the 404 error page, you need to make sure that you delete the theme for security and storage reasons. WordPress themes are common security vulnerabilities and take up your storage which will, in turn, affect the speed of the website. We have made an in-depth guide on how to uninstall and delete WordPress theme. Feel free to check it out!

Switching WordPress themes can sound a bit tricky, but it’s worth it in the long run if your current theme is resulting in errors.

Disable Your Plugins

There are two ways to do this, depending on whether you have access to your dashboard or not. If you do have access, go to the Plugins › All Plugins tab and follow this process for each of your plugins:

  1. Click on the Deactivate button below the plugin’s name.
  2. Check your site, to see if the 404 error persists.
  3. If the error is still there, re-activate the plugin you disabled.
  4. Move to the next plugin on the list, and repeat the process.

Your goal here is to eliminate each plugin as a suspect, one by one, which is the reason for returning 404 errors on WordPress posts. You could disable all of them at once, but in most cases, it’s a single plugin that’s causing your problems.

If disabling one of your plugins fixes the issue, you have three options. You can see if there’s an update available, keep the plugin temporarily disabled until there’s an update, or uninstall it and look for an alternative.

What If You Don’t Have The Access To Your Dashboard?

If you don’t have access to your dashboard, you can still disable your theme and plugins manually via FTP. To do this, 

  • Access your website using FileZilla, then navigate to the public_html/wp-content directory. 
  • You’ll find several folders here, two of which are plugins and themes respectively:
plugins theme folder on wordpress
  • Go into the plugins directory first. You’ll notice that there are individual folders for each plugin on your website. 
  • What you need to do is select one of those folders, right-click on it, and choose the Rename option:
  • Change the folder’s name to something like akismet.disabled, so you can still easily identify it. 
  • The mere act of changing the plugin folder’s name is enough for WordPress to disable it. 
  • Now, check to see if the 404 error is gone. If it isn’t, return that folder to its original name, and repeat this process in turn for each other plugin within the directory.

If one of your plugins is behind the returning 404 error on your WordPress post, you know how to fix it by now. However, if they all come up clean, you can move on to the wp-content › themes directory. Once you’re in, look for your active theme’s folder and rename it, just as you did with your plugins.

Since WordPress always needs an active theme, disabling yours will cause the platform to default to one of its out-of-the-box options. This can affect the way your website looks, but don’t worry, it’s only temporary.

Install a new theme once the error is over. However, if it isn’t, feel free to restore your theme’s folder to its original name, so WordPress recognizes it again.

Fix Posts Returning 404 Error Now!!!

The WordPress posts returning 404 errors may seem simple, but they can do a lot of damage, and you need to fix it. If your visitors can’t find the pages they want, they might look elsewhere for what they need. That translates to lost traffic, and potentially fewer conversions.

Fortunately, there are plenty of ways you can fix posts returning 404 error in WordPress, including disabling your themes and plugins, restoring your .htaccess file, and resetting your permalinks.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.