• Steps to reproduce bug:

    • Install a fresh WordPress
    • Install Yoast plugin
    • Install XML Sitemap & Google News feed
    • In Yoast plugin settings disable “Date Archive” listing
    • In XML Sitemap settings, set post monthly sitemap

    You will be redirected to homepage, if you’ll try to read the post type xml sitemap (eg: https://xmlsitemap.local/sitemap-posttype-post.201712.xml)

    My temporary workaround:

    add_action(
        'pre_get_posts',
    	function ( $query ) {
                if (get_query_var('feed') == 'sitemap-posttype-post') {
                    $query->is_date = false;
    	    }
        });

    Anyone could help, please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @daweb, thanks for this report. It’s an interesting and excellent find of both the issue and the solution.

    So if is_date() is true, Yoast redirects to the front page? Does it redirect normal date archives to the front page too or does that only happen to the sitemap feeds?

    And if so, I wonder why…

    In any case, setting the date flag to false would not be difficult nor problematic at all.

    Another question: why did you not choose to use the sitemap provided by Yoast’s plugin?

    Thread Starter Davide Prevosto

    (@daweb)

    Hi @ravanh,

    I am still using Yoast sitemap, but I like to “look around for better solutions” sometimes.

    Yoast allows you to switch off “Dates Archive”, and it redirects to homepage in those case.

    Ah, ok so it’s only a specific setting…?I’ll work your fix into the next release. Thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[BUG] Yoast / Date archives settings’ is closed to new replies.