How to Fix WordPress Posts Returning 404 Error

Ninetheme

Despite being the world’s most popular content management system, you will occasionally encounter errors when using WordPress – one such issue is WordPress posts returning 404 errors. Fortunately, resolving the 404 error in WordPress can be simple.

In most cases, these are caused by problems with your .htaccess file. This means that when you reconfigure or restore this file, the problem is fixed. In this tutorial, we’ll take a look at how to fix WordPress posts returning 404 errors. Let’s see!

Note: You can see the tutorial video at the end of the article.

What is 404 Error in WordPress?

404 errors are not specific to WordPress; It can be on any type of website. These errors pop up when a page is not found. In most cases, browsers cannot find these pages and cannot access them because they do not exist.

It’s usually a minor annoyance if your browser is giving a 404 error because there isn’t a page. But in some cases, you may encounter 404 errors for pages you know are there.

Ways to Fix WordPress Posts 404 Error

Which method is correct depends on each particular case. Our step-by-step algorithm will allow to fix this problem quickly and easily. Here are the steps you should take:

  • Fix permalinks
  • Reset .htaccess File
  • Disable All Your Themes and Plugins permissions
  • Check if your theme is causing the error
  • Deactivate all plugins and check if there’s a plugin which causes this problem

Most likely, the first or second step is enough for most people to fix this error. But even if these do not help, continue with the next steps until you resolve the error. Let’s analyze each of the steps in detail.

1. Reconfigure Your WordPress Permalinks

WordPress gives you multiple permalink structure options. ‘Permalink’ means permalink. The URL your website visitors use to access your pages and posts.

In some cases, WordPress may encounter errors when creating permalinks, which can cause a 404 error. To fix this issue, you need to temporarily reset your site’s permalink structure. This will only apply if you are using any permalink structure other than the default Plain.

To reset your permalink structure, access your WordPress admin area and go to Settings > Permalinks. Save or write down your current settings here, then select Flat under Common Settings:

The page will reload after you save your changes. At this point, reselect your old permalink structure and save your changes again.

Although the permalink structure is reset only once, this can often be enough to clear the 404 error. If not, you need to dig deeper in WordPress.

2. Reset .htaccess File

The .htaccess file can be found in the root of your website. You can use FTP, cPanel, command line, SSH to access. You can download it and make the necessary edits in a text editor, and then upload it to replace the old file or edit it directly.

We recommend making a complete backup of your website before making any such changes. If you haven’t made any changes to the .htacess file, you can delete it and click “Save” in the “Permalinks” section of “Settings”. WordPress will create a new .htaccess file from scratch and you won’t need to make any edits.

Otherwise, replace the following code with the existing code in your .htaccess file (if you only have one WordPress installation):

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

However, if you are running your WordPress website on a subdomain, add the following code:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]


# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

Also, if we’re dealing with a subdirectory setup, enter this code instead:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]


# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

If you are using WordPress 3.4 or older, refer to this htacesss reference guide from WordPress Codex. After updating your .htaccess code, the 404 error will disappear. If that didn’t help us move on to our next step.

3. Disable All Your Themes and Plugins

In some cases, compatibility issues between plugins, themes, and WordPress itself can cause a 404 error on your website.

So, if both previous methods were not successful, the next step is to disable all your plugins and themes to see if you have compatibility issues.

To disable your plugins and themes from the dashboard, go to the corresponding screen in the WordPress admin area (Plugins > Installed Plugins or Appearance > Themes), select the plugins or themes you want to disable, then select Disable under Bulk. Select the actions drop-down menu and click the Apply button:

This is the fastest way to disable all plugins on your website. Doing so will likely affect your site’s functionality, but it is necessary to rule out each plugin as the cause of the 404 error. If you don’t want to perform this action on your live site, we recommend creating a staging site.

If the error persists after disabling each plugin, you should also disable your active themes.

And if the error still does not go away, re-enable all plugins and themes and do the following:

  • Disable add-ons one by one.
  • After disabling a plugin, test to see if the WordPress 404 error persists.
  • If the error persists, re-enable the plugin and repeat the process with the next.

This should enable you to identify which plugin is causing compatibility issues on your website.

If the 404 error is preventing you from accessing your clipboard, you can also disable plugins and themes on your site via FTP. To do this, connect to your website via your FTP client, navigate to your root folder and access the wp-content directory. Here you will see several folders, including two plugins and themes:

Each of these directories contains subfolders for all the plugins and themes installed on your website.

To disable plugins in bulk, you can right-click on the plugins folder and rename it to something else, for example plugins.old . Next, create a new plugin folder that should be empty:

Now try to access your website again to check if the 404 error still appears. If it’s gone, you can delete the empty folder and rename the other one as plugins.

Your next move is to exclude individual add-ons. To do this, open the plugins directory and follow these instructions:

  • Rename a plugin’s folder.
  • Check if the 404 error persists on your website.
  • If yes, rename the folder to its original name and repeat the process with the next plugin.

If the error disappears at any point, you can assume the plugin is the culprit. At this point, you need to contact the developer for a fix, look for a suitable alternative, or uninstall the add-on.

This process works pretty much the same as with themes. If you rename your active theme’s folder, WordPress will automatically use the default theme instead. After renaming the folder, test your website and if the error is gone, the root cause is your old theme.

4. Check If Your Theme Is Cause An Error

If you’re still not successful, disable your current theme and enable WordPress classic Twenty Seventeen. Go to the “Themes” section of “Appearance”, find Twenty Seventeen and click “Enable”. Check if the 404 error is still there. If it’s gone, then it’s the theme you’re using that’s causing the error. Otherwise, go to the next step.

Video Tutorial

Play Video about Ninetheme Video Banner

We hope this article helped you fix the WordPress Posts Returning 404 Error. You may also want to see our list of the most common WordPress errors and how to fix them.

If you liked this article, please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Dribbble and Behance.

If you have any questions about this article or other topics, please click the button below. Your questions will be answered soon.

If you want an affordable, reliable and fast WordPress server, just go ahead and click on the button and get a package as needed.