• Resolved Ben L.

    (@nightgunner5)


    <?php get_header(); ?> just doesn’t work in this situation. It doesn’t let me add a meta noindex, nofollow tag, so I can’t block googlebot from filling my 404 log with the /category/ page. I tried using a file_get_contents php function, but that made my php code be not parsed and it messed up the format of the page. Is there any easier way to add a meta tag to my 404.php file? Am I missing something really obvious?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello

    In header.php add:

    <?php if( is_404() ) { ?>
     <meta name="robots" content="noindex,nofollow" />
    <?php } ?>

    Hope it helps. 🙂

    Thread Starter Ben L.

    (@nightgunner5)

    Amazing, I would have never thought that it would be that easy! Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I add a meta tag to my 404 page?’ is closed to new replies.