Support » Plugin: XML Sitemaps » BUG caused by empty categories

  • Below is logged in www-error:

    PHP Warning: Undefined array key 0 in XXXXX/wp-content/plugins/google-sitemap-generator/class-googlesitemapgeneratorstandardbuilder.php on line 696
    PHP Warning: Attempt to read property “taxonomy” on null in XXXXX/wp-content/plugins/google-sitemap-generator/class-googlesitemapgeneratorstandardbuilder.php on line 696
    PHP Warning: Undefined array key 0 in XXXXX/wp-content/plugins/google-sitemap-generator/class-googlesitemapgeneratorstandardbuilder.php on line 697
    PHP Warning: Attempt to read property “taxonomy” on null in XXXXX/wp-content/plugins/google-sitemap-generator/class-googlesitemapgeneratorstandardbuilder.php on line 697

    while in the generating result, a bad entry like
    https://xxx.com/sitemap-tax–1.xml
    appears, but if I refresh the page, it should get normal, until, a cache expiration time.

    I’ve traced in this BUG, and found that since my first category is empty, it is filtered out by core get_terms function, without a re-index, which makes $taxs[ 0 ] unset.

    Recommend a call of array_values() to make it work.

    As for why it can be recovered by a refresh, I found it’s due to the core BUG, for cached term query result, ‘hide_empty’=>TRUE (default value) does not work, so instead, $taxs[0] is back.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.