Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi, that should not be happening. It looks like the plugin thinks there are no posts younger than 48 hours and it defaults to only the latest one it can find.

    Obviously there are more recent posts from the last two days so it’s unclear to my why the sitemap would think otherwise.

    I also notice there are other posts with weird date issues. See the normal sitemap index on http://www.lowkickmma.com/sitemap.xml where there are two weird sitemap year dates. One from the yer 1300 and another from 1878. Each one has only one post in there.

    These posts do also show on the front end these weird post dates:
    http://www.lowkickmma.com/UFC/tuf-cast-for-team-ortiz-vs-team-liddell-6804/
    http://www.lowkickmma.com/UFC/Anthony-Johnson-pulls-out-of-March-bout-6496/

    Could you edit these posts to see what publication date is shown on the admin side? And maybe change the post date to their original date to see if that changes anything on the sitemap?

    I really wonder how/why these weird dates come about on your site… Have you noticed that before? Any recent OS updates? What PHP and MySQL versions are running? Other plugins installed installed recently?

    Thread Starter bensword

    (@bensword)

    Hey

    Sorry, I didnt catch your reply on this one.

    Guess it was because the issue went away….

    But now it is back again.
    Shows only one post on the sitemap…

    php version: 5.6.30

    On thing is my admin dashboard runs on https….while site is on http.
    Might have some relation?

    Thanks,
    Ben

    Hi Ben, no the plugin should not have any issues with https on admin and http on the front end. Do you have the news sitemap limited to certain categories on Settings > Reading maybe?

    Thread Starter bensword

    (@bensword)

    no, I have also picked all categories and its not working.

    It actually was showing all of the articles one day and then went back to showing only one…
    It comes and goes…

    Never seen such a thing… Did you try disabling all other plugins for a minute?

    Do you know if the server time is correct?

    Thread Starter bensword

    (@bensword)

    Yeah. I actually changed to a similar plugin and it now works…

    Wow, that does look very similar indeed. In fact, it seems to be an exact but “rebranded” copy of an (slightly) older version of my plugin…

    I’ll have to study this one to find out where the difference is that could explain your issue.

    I cannot find any differences that could be related to this time issue.

    Please let me know if the issue comes back with this other plugin too 🙂

    Thread Starter bensword

    (@bensword)

    Hey,

    Well the issue is back also with this copycat plugin.

    I have reinstalled your but still get the error.

    Do you have a caching plugin installed? Or do know if your host (is that Presslabs?) uses some kind of object caching?

    Thread Starter bensword

    (@bensword)

    Presslab are my hosting company.

    They have found an issue with the Yoast plugin and deployed a patch.

    The sitemap seem to be working now.

    So you are using Yoast SEO? But you had NOT enabled the sitemap option in that plugin, right?

    I really wonder how the Yoast plugin could interfere with my plugin if the yoast sitemap is not activated… Do you know what patch they deployed? Or was it just an update to the latest version of that plugin?

    Thank you for your feedback 🙂

    Thread Starter bensword

    (@bensword)

    Hey

    Look at my hosting team reply:

    I’m not entirely sure, but I found this piece of code in the plugin, inside includes/class-xmlsitemapfeed.php, function filter_request:
    // set up query filters
    $zone = $this->timezone();
    if ( get_lastdate($zone, $news_post_type) > date(‘Y-m-d H:i:s’, strtotime(‘-48 hours’)) ) {
    add_filter(‘post_limits’, array($this, ‘filter_news_limits’));
    add_filter(‘posts_where’, array($this, ‘filter_news_where’), 10, 1);
    } else {
    add_filter(‘post_limits’, array($this, ‘filter_no_news_limits’));
    }

    Here’s one way that the plugin could intend to only have one post on sitemap-news.xml: if that condition of having a post published earlier than two days ago is not valid (meaning your latest post is 2 days old), then the sitemap will only contain the most recent post. I don’t understand the logic behind that, but that’s not my call. The date of the latest post is obtained through a function provided by the plugin as well, get_lastdate().
    This function retrieves the date of the latest post but stores some things like the timezone in Memcache. The plugin also clears the cache and asks the database for a fresh copy of the options which represent interest, also inside includes/class-xmlsitemapfeed.php in the function cache_flush().
    I think the problem relies here, although I can’t explain it 100%. The cache isn’t flushed correctly, as the developer only clears certain keys inside the cache. Relying on that, you’ve ended up several times with that single post on your sitemap-news.xml. But if I go in that cache_flush function and add a wp_cache_flush() call, which tells WordPress to clear the entire object cache, the plugin works just fine. That line of code makes all the difference, although it is only a fix of mine which isn’t necessarily a best practice.

    Maybe given this info you could provide to the developer he could narrow down the issue more than I could, for now all I managed is to provide some clues that I hope will be helpful.

    Thanks for the feedback 🙂

    It appears they are indeed using an object cache. Do you know which plugin is doing that? W3 Total Cache by any chance? If so, that would explain it. There is a known issue with object cache invalidation there… However, your feedback did lead me to find a bug in my own code too. Not completely sure if that is going to address your specific issue but it does seem to be related and will be fixed in the next release.

    So if the problem comes back after the next update, please let me know! 🙂

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Sitemap shows only 1 article’ is closed to new replies.