Viewing 1 replies (of 1 total)
  • Thread Starter seymour-james

    (@seymour-james)

    it appears in my case for whatever reason that line 182 in class-sitemaps.php is not working correctly and setting a 404 status code for invalid or empty site maps.

    $GLOBALS[‘wp_query’]->is_404 = true;

    However if this line is replaced with the code below the correct header is returned for non-existing site map files

    global $wp_query;
    $wp_query->set_404();
    status_header(404);

    Problem solved but do not fully understand why $GLOBALS[‘wp_query’]->is_404 = true; is not working correctly – > perhaps W3 Total Cache?

    The reason why this could be important is if a spammer knows you are using YOAST, he spam links to “non-existent” pages which appear to search engines as normal pages with 200 O.K. status.

Viewing 1 replies (of 1 total)
  • The topic ‘Unused/Unchecked XML site map urls not returning 404’ is closed to new replies.