Support » Plugin: Seriously Simple Podcasting » 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… 🤔

    • This topic was modified 4 months, 3 weeks ago by davidwebca.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sergio Zakharchenko

    (@zahardoc)

    Hi @davidwebca!

    Thank you for these great questions and suggestions.

    1. “I don’t think anyone expect archive-podcast.php to be used..”
    We just follow the WP template – https://developer.wordpress.org/files/2014/10/Screenshot-2019-01-23-00.20.04.png
    By it, archive-$posttype.php should work, but it doesn’t. Please correct me if I misunderstand it.
    Besides, sometimes it’s easier to edit only one archive template than two.

    2. “the code is wrong on class-frontend-controller.php line 117.”
    Totally agree with you, and actually, we already fixed it in the development branch, so it will be available in the next plugin version.

    3. “For now, I had to resort to removing this filter altogether by removing the filter on the global var.”
    Agree, for now, it’s the best solution. I believe with the next plugin version you’ll be able to remove that fix. We’re going to release it at the very beginning of January.

    4. “why are you not updating the github repo anymore?”
    We recently moved it to GitLab, and for now, it’s temporarily private for some security reasons. We’ll announce when it becomes public.

    Thanks again and have a good day,
    Sergey.

    Thread Starter davidwebca

    (@davidwebca)

    1. Oh, sorry! I meant for the post tags since there is a condition check for those. Otherwise, even without the filter, my archive-podcast.php gets picked up for the post type archive, so I was confused.

    2. Nice!

    3. Glad to hear.

    4. No worries, I was just wondering.

    Thanks for your follow-up and I wish you and your family Happy Holidays!

    Plugin Author Sergio Zakharchenko

    (@zahardoc)

    Thanks, @davidwebca!

    Happy Holidays and prosperity in the next year!

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