Support » Plugin: Yoast SEO » Invalid sitemap that is not on sitemap_index.xml

  • Resolved Peter Berger

    (@petercabrinha)


    Google search Console reports url 404 errors for smartphone. The url has a link from a Yoast generated sitemap. That sitemap indeed exists on the site but is not on the Yoast generated list sitemap_index.xml.

    How do I delete this site map that has non existing links and is not on sitemap index? I disabled, enabled sitemaps in Yoast. I deleted cache of autopimize and super cache. What else can I do?

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hi @petercabrinha,

    Yoast SEO makes list of sitemaps “on fly”, so it isn’t easy to do it. Maybe it’s possible to use PHP code and some filter.

    Could you send only path (without website URL) for this sitemap and is it related to custom taxonomy or post type or something else? I’ll try to reproduce this issue if you send more details.

    Plugin Support Michael Tina

    (@mikes41720)

    You can refer to this KB article on how to customize the Yoast XML Sitemap Index — https://kb.yoast.com/kb/how-to-customize-the-sitemap-index/

    Could you please provide a screenshot from GSC that reports that 404 URL coming from the Yoast generated sitemap?

    Thread Starter Peter Berger

    (@petercabrinha)

    Hi @saša and @michael,

    @saša This path /gd_placecategory_location_city-sitemap.xml

    @michael The site map is not in the index. It shows the locations of listings without mentioning the region. Probably because I used that before, but not anymore. The sitemap with regions is in the index.
    Screenshot
    https://www.dropbox.com/s/h7hn8jy384d47dx/Yoast.png?dl=0

    I use geodirectory pluging for the locations.

    Thank yoy both.

    I can’t determine is it custom taxonomy or post type. You could use one of filters wpseo_sitemap_exclude_post_type or wpseo_sitemap_exclude_taxonomy to exclude this post_type/taxonomy.

    If it’s custom taxonomy please check is it private. If it’s private taxonomy then it could be issue in Yoast SEO plugin. Please send more details, I’ll try to test it and open new issue on github if it needs.

    You could try this code for CPT:

    add_filter( 'wpseo_sitemap_exclude_post_type', 'my_wpseo_sitemap_exclude_post_type', 10, 2 );
    function my_wpseo_sitemap_exclude_post_type( $exclude, $post_type ) {
    	if ( $post_type === 'gd_placecategory_location_city' ) {
    		$exclude = true;
    	}
    	return $exclude;
    }
    

    or for custom taxonomy:

    add_filter( 'wpseo_sitemap_exclude_taxonomy', 'my_wpseo_sitemap_exclude_taxonomy', 10, 2 );
    function my_wpseo_sitemap_exclude_taxonomy( $exclude, $taxonomy_name ) {
    	if ( $taxonomy_name === 'gd_placecategory_location_city' ) {
    		$exclude = true;
    	}
    	return $exclude;
    }
    

    I hope that helps and we are waiting more details.

    Thread Starter Peter Berger

    (@petercabrinha)

    I don’t know how to determine if it is custom taxonomy or post type. I don’t know private or not.

    I added the code. I tried both. But they get a red warning in Code Snippets.

    What more details do you need?

    Thanks, Peter

    It seems that’s custom taxonomy. I’ve tried to install geodirectory plugin (free version) and default taxonomies are:

    $ wp-cli taxonomy list                                    
    +--------------------------------+------------------+-------------+---------------+---------------+--------------+--------+
    | name                           | label            | description | object_type   | show_tagcloud | hierarchical | public |
    +--------------------------------+------------------+-------------+---------------+---------------+--------------+--------+
    | category                       | Categories       |             | post          | 1             | 1            | 1      |
    | post_tag                       | Tags             |             | post          | 1             |              | 1      |
    | nav_menu                       | Navigation Menus |             | nav_menu_item |               |              |        |
    | link_category                  | Link Categories  |             | link          | 1             |              |        |
    | post_format                    | Format           |             | post          |               |              | 1      |
    | gd_place_tags                  | Place Tags       |             | gd_place      | 1             |              | 1      |
    | gd_placecategory               | Place Categories |             | gd_place      | 1             | 1            | 1      |
    +--------------------------------+------------------+-------------+---------------+---------------+--------------+--------+
    

    I don’t know more details, but it seems that geodirectory plugin stores info about taxonomies into option geodir_taxonomies (I see it into function geodir_register_taxonomies). So, it’ll be helpful if you could somehow get value of this option from database and send it here.

    I’ve tried to reproduce similar issues but without success. Please try to delete all transients from database. If you use object cache then please purge object cache.

    I’ve tried the code (I’ve added it at the end of functions.php before ?> if this line exists) and it works in my case.

    Regards,
    Saša

    Thread Starter Peter Berger

    (@petercabrinha)

    Hi Saša

    The code is now accepted. How do I know if it works. I should think that the sitemap url doesnt give the page. But info is still shown.

    If got no clue about getting info from database. Too technical. Sorry.

    Thanks, Peter

    Hi Peter,

    I’ve tried to check your sitemaps and I see that regular URL returns sitemap, but if I try to get sitemap via query parameter (home_url/index.php?sitemap=gd_placecategory_location_city) then I see 404 error (so, I’d guess that Yoast doesn’t generate this sitemap now – I can get other sitemaps on this way).

    It’s possible that sitemap is cached in transients (object cache or database). Anyway, after each change in the code (related to sitemap) you should try to disable sitemap, delete cache if you have it and enable sitemaps again (https://kb.yoast.com/kb/sitemap-does-not-update/).

    After this, try to access to sitemap again. If it still works, then please try to temporary disable sitemaps and try to access to sitemaps when they are disabled (maybe they are cached somehow). Do you have cache plugin (WPSC, W3TC, something else)?

    Also, you could try to delete transients. There are plugins: Delete Expired Transients and Transients Manager.

    I don’t have more advises at this moment.

    Regards,
    Sasa

    Thread Starter Peter Berger

    (@petercabrinha)

    Hi Sasa,

    Thanks a lot for your help. I excluded the map from WP super cache now. I emptied cashes again.

    Then, I disabled Yoast sidemaps. Then there are no sidemaps. Then I put it back on: all sidemaps are back.

    I’ll study on transients. Never met them before :-).

    Maybe I should let it go for now. Or uninstall Yoast and reinstall.

    Thanks again for your help.

    Best regards, Peter

    I think that re-installation will not change anything. Disable/Enable sitemaps should purge cache, but maybe there exist old transients where sitemap cache is stored.

    It’s safe to delete all transients because WP (and plugins) makes new refreshed transients “on the fly”. It’s possible that’s issue related to transients. It’ll be great to we exclude this possibility.

    WP Super Cache stores sitemaps as feeds (use wp-cache files), so each post change (gdplace is CPT) should purge WPSC cache.

    Thread Starter Peter Berger

    (@petercabrinha)

    I deleted all transients, but sitemap is still there.

    I added the code given by Yoast to exclude sitemaps in WP Super Cache earlier today.

    I also use Autoptimize.

    Thread Starter Peter Berger

    (@petercabrinha)

    Site is now a lot slower. Is that temporary?

    It’s temporary. It’s often enough to view few different type of pages to populate transients, but it depends on plugins.

    I tried to reproduce this issue again but without success. Do you have installed free or premium geodirectory plugin?

    I can create simple PHP script which you should upload in directory where WP is installed (via FTP) and run directly into browser( https://example.com/sitemap-test.php ). It’ll show details for custom taxonomy (or post) gd_placecategory_location_city. If you want to try this solution let me know and I’ll try to create it and test first on my development server.

    Thread Starter Peter Berger

    (@petercabrinha)

    Yes, that was temporary!

    Thread Starter Peter Berger

    (@petercabrinha)

    The Geodirectory plugin is free. I also use the location managager plugin (and a few others) to have more locations. THese plugins are paid for.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Invalid sitemap that is not on sitemap_index.xml’ is closed to new replies.