Custom taxonomies create bad links
-
WP is 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 2891PHP Notice: Undefined property: stdClass::$taxonomy in /wp-includes/taxonomy.php on line 2901
elseif ( $t->query_var )
// line 2901The reason for this is that the $term object doesn’t contain the expected property, because the alias in the plugin’s 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
- The topic ‘Custom taxonomies create bad links’ is closed to new replies.