Title: [Plugin: Google XML Sitemaps] Custom taxonomy sql bug
Last modified: August 20, 2016

---

# [Plugin: Google XML Sitemaps] Custom taxonomy sql bug

 *  [kilobytes](https://wordpress.org/support/users/kilobytes/)
 * (@kilobytes)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-google-xml-sitemaps-custom-taxonomy-sql-bug/)
 * There seems to be an error in the sql query that fetches custom taxonomies, because
   the sitemap is not showing all the groupings. I think the following join fetches
   the wrong rows:
 * AND r.term_taxonomy_id = t.term_id
 * instead, it should be:
 * AND r.term_taxonomy_id = tt.term_taxonomy_id
 * This is in the Beta release of the plugin, as well as the previous.
 * Furthermore, WP is also throwing some PHP Notices in get_term_link() because 
   it’s not finding the expected object property. And the function returns an incomplete
   link.
 * PHP Notice: Trying to get property of non-object in /wp-includes/taxonomy.php
   on line 2891
 * $taxonomy = $term->taxonomy; // line 2891
 * PHP Notice: Undefined property: stdClass::$taxonomy in /wp-includes/taxonomy.
   php on line 2901
 * elseif ( $t->query_var ) // line 2901
 * The reason for this is that the $term object doesn’t contain the expected property,
   because the alias in the same sql query is “_taxonomy”:
 * SELECT … tt.taxonomy AS _taxonomy (sitemap-core.php line 2126)
 * Then inside get_term_link() the code branches to line 2904 and produces an incomplete
   link because $taxonomy is empty
 * $termlink = “?taxonomy=$taxonomy&term=$slug”; // line 2904
 * [http://wordpress.org/extend/plugins/google-sitemap-generator/](http://wordpress.org/extend/plugins/google-sitemap-generator/)

The topic ‘[Plugin: Google XML Sitemaps] Custom taxonomy sql bug’ is closed to new
replies.

 * ![](https://ps.w.org/google-sitemap-generator/assets/icon-256x256.png?rev=2713572)
 * [XML Sitemap Generator for Google](https://wordpress.org/plugins/google-sitemap-generator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-sitemap-generator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-sitemap-generator/)
 * [Active Topics](https://wordpress.org/support/plugin/google-sitemap-generator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-sitemap-generator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-sitemap-generator/reviews/)

## Tags

 * [sql](https://wordpress.org/support/topic-tag/sql/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * 0 replies
 * 1 participant
 * Last reply from: [kilobytes](https://wordpress.org/support/users/kilobytes/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-google-xml-sitemaps-custom-taxonomy-sql-bug/)
 * Status: not resolved