• Hi,

    I have an issue where tags that were removed some time ago are not generating 404 page not found errors.

    It would not seem a big issue, except I’ve just noticed Google’s Webmaster tools is reporting a bunch of errors with these pages having duplicate title and meta descriptions. These pages actually do not exist at all, and if I can get them to generate a 404 all will be fine.

    Here is an example of a tag page not creating a 404 page:
    https://i.padaccessories.info/tag/vangoddy/
    This tag does not exist, and was deleted a few months ago.

    I’ve made some progress in troubleshooting this, but have run into a brick wall.

    I’m certain this is theme related and have identified the code that causes the page to load some default content rather than a 404. I just don’t know what to change to make it load a 404 instead.

    The theme I am using is Motion. Before I get to the progress I have made, I should also note that the theme does not include a 404.php template. I was having similar issues with a few posts that were removed, Google was continuing to index them, but thought the content had changed to an error message. I have fixed this by simply adding a 404.php to the theme. Now if you enter a nonsense URL it does resolve to the correct 404 page.
    Example nonsense URL: https://i.padaccessories.info/oihdfdhf

    A tip for anyone using the beautiful Motion theme is to add a 404.php – this could save you some strife with Google thinking you have duplicate content on old posts you have deleted.

    Interestingly, adding the 404.php has not affected tag pages that no longer exist. As can be seen in the example link at top – it looks like an error page – but it is not a 404. If in doubt you can run those URL’s through a service like: https://web-sniffer.net/ to see the http headers returned by the page. The nonsense URL will give you a 404, the tag page at top will return Status: HTTP/1.1 200 OK

    And here is the code in the theme file which generates the error if it can’t find any tag content:

    <?php else : ?>
        <div class="post">
          <div class="posttop">
            <h2 class="posttitle"><a href="#">Oups!</a></h2>
          </div>
          <!-- /posttop -->
          <div class="postcontent">
            <p>What you are looking for doesn't seem to be on this page...</p>
          </div>

    What I don’t understand is why a missing post will default to the 404.php, and why a missing tag defaults to this error message built into the theme. It’s a problem because it means the tag still exists in the eyes of the search engines – only it has precisely the same content (the error message) as a bunch of other deleted tag pages.

    Is there a way to replace the error message above with something that tells WordPress to go to 404.php instead?

    Many thanks

  • The topic ‘Deleted Tags do not generate 404 error’ is closed to new replies.