2.9.9 fix_template_hierarchy breaks template hierarchy
-
In the latest release 2.9.9, a function has been introduced “fix_template_hierarchy” that weirdly tries to force series and post_tag archives to use archive-podcast.php down in the template hierarchy deduction that WordPress does, but it’s wrong… unless I don’t understand the reasoning?
I don’t think anyone expect archive-podcast.php to be used down the line since it’s unrelated to series or post_tag. For the series, people expect taxonomy-series.php and if people use “post_tag” (core WP post tags) as a taxonomy alongside the podcasts, they’re expecting archive-post_tag.php to be picked up, not archive-podcast.php.
That being said, it shouldn’t be a problem since it wouldn’t be picked up first, but the code is wrong on class-frontend-controller.php line 117.
if ( is_tax( 'series' ) || ( $use_post_tag && 'post_tag' === $queried->taxonomy ) ) {
The queried object doesn’t always have a taxonomy and this code causes a crash on every archive that’s not a taxonomy.
For now, I had to resort to removing this filter altogether by removing the filter on the global var.
global $ss_podcasting; remove_filter('archive_template_hierarchy', [$ss_podcasting, 'fix_template_hierarchy']);
Suggested fix, add the “isset” check first:
if ( is_tax( 'series' ) || ( $use_post_tag && isset($queried->taxonomy) && 'post_tag' === $queried->taxonomy ) ) {
Sidenote: why are you not updating the github repo anymore? I would have done the pull request if it was up to date… 🤔
- You must be logged in to reply to this topic.