How to Fix Soft 404 Errors on Most WordPress Themes

By 11/06/2017 November 20th, 2019 SEO, Web Design

Soft 404 errors can be quite common in most WordPress themes and it is something that needs to be addressed for your website to work properly.

Soft 404 vs Traditional 404 Error

When a visitor goes to your website and attempts to open a page that no longer exists, your website usually reacts by displaying a custom “404 page not found” page, and returning a 404 HTTP response to show the search engines that the content is no longer there. This is normal!

A Soft 404 error happens when a page has no content but the website does not return a 404 HTTP response for the page. While Soft 404 errors don’t usually interfere with the user experience greatly, it can hamper your sites search rankings.

Understanding Soft 404 Errors

The most common cause of a Soft 404 error is when a user is searching for a query, on a site’s internal search engine, that does not exist.

Let’s say that you have a blog and it is about Landing Pages. So, for example, if I go to your page and I search for something that doesn’t exist on your page, it will return an error “No match” or “Not found”.

search query

If the server response code is 200 OK, this means you have a Soft 404 error. You will know this because the server response code should say, 404 Not Found when something does not exist on your site.

The other reason is that you have a category or tag that doesn’t have any content under the category. So, when someone clicks on your link, there is nowhere for them to be lead to. This will also lead to the Soft 404 error if the server response code is 200 OK.

Finding the Errors in Your Pages

To find the errors in your code you need to do a little digging. First, you will want to Sign in to your Google Search Console, then click on the Crawl Errors, Soft 404 tab. Here you will find any errors on your sites listed in order of importance.

Soft 404 error sample

If you have any Soft 404 errors, Google will display them here. Once you have the errors on your page isolated, you can check them by using Firefox or Chrome. For this example, we will use Firefox. To do so, copy the error code from your Search Console and past it at the end of your URL and click enter on your browser.



After this, go to Tools > Web Developer > Inspector on Firefox. Once you do this you should see the Inspector open up at the bottom, like in the example below.

200 OK code

Notice at the side it says the status is 200 OK? This is how the browser is tricking the search engines and it is the reason why we see the Soft 404 error in the Google’s Search Console. The status should be 404 Not Found because this page does not exist. It is a non-existing search query. Next, we will resolve this error so it is no longer plaguing your site.

Fixing the Error

If your search query error looks a little bit different then from the example shown here, it is okay. Whatever error code you see in your Search Console use that rather than the ones above.

Most WordPress themes should have search.php file, find that file and past this code in there.

if ('{query}' == get_search_query( false )){
header( 'HTTP/1.0 404 Not Found' );
$GLOBALS['wp_query']->is_404 = TRUE;

Save and upload it to your server. Make sure you keep the backup of your original search.php file just in case something goes wrong, you have the original back up of the file.

If you are using a cache plugin, remember to clear the cache after you upload the changes to the server. 

Now go back to Firefox and repeat the testing process explained in “Finding the Errors in Your Pages” section above.

Hard 404 fix

Now you should see traditional 404 Not Found error instead of 200 OK! When the search engines re-crawl your website again, they will notice the changes and your Soft 404 issue will be gone.


  • karan says:

    Hello, Can you tell me what is better for SEO, it is good to point all your soft 404 pages to the home page or create a relevant article for 404 pages?

    • Amberd says:

      Are you talking about Soft 404 or Hard 404? I think you meant to say Hard 404 (or just simply 404), the Soft 404 is very different from the Hard and its explained how to troubleshoot and fix in this article.

      You can do one of the following if you meant Hard 404:

      1. You can redirect old URLs to the new ones.
      2. You can create relevant and meaningful content for those 404s that have a lot of links pointing to them. This way you will get all that lost link juice back to your site.
      3. Leave as they are if you do not intend to create content, they are perfectly fine. The search engines will not penalize you for having 404s.

      Thank you!

Leave a Reply

Proverbs 9:10