[wp-trac] [WordPress Trac] #13816: There should be built-in index pages for taxonomies

WordPress Trac noreply at wordpress.org
Fri Jun 7 17:50:28 UTC 2019


#13816: There should be built-in index pages for taxonomies
--------------------------------------+-----------------------------
 Reporter:  frankieroberto            |       Owner:  (none)
     Type:  feature request           |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  Taxonomy                  |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |     Focuses:  template
--------------------------------------+-----------------------------
Changes (by tomauger):

 * keywords:  needs-patch => needs-patch dev-feedback
 * focuses:   => template


Comment:

 I'd love to revive this conversation as the use case is clear and is
 something that we have all been working around for years and years: the
 need for an archive of taxonomy terms, supported as a first-class citizen
 in the template hierarchy and the rewrite rules.

 I still need to review @SergeyBiryukov 's comment in Slack (having a bit
 of access issues at the moment) to see if there's any additional context,
 but the main issues I think that need to be settled are:

 1. Is this a ''taxonomy term'' archive or a ''post'' archive?
 2. What is the nomenclature of the template file name within the
 ''template hierarchy''?

 To sum up: if someone types the following URL: https://mysite.com
 /taxonomy-name/term-slug, we send them to a ''taxonomy term'' archive
 (taxonomy-$taxonomy-$term.php etc...); if they type https://mysite.com
 /taxonomy-name/ we 404.

 The issue with (1) appears to be (based on comments in this ticket and
 elsewhere) does mysite.com/taxonomy-name take users to an archive of
 ''terms'' (i.e.: a listing of all the terms within ''taxonomy-name'') or
 is take users to a listing of all the ''posts'' that have at least one
 term in that taxonomy.

 To me, **the first option has the most common use cases**, and should be
 the right answer here. ''https://my-movie-db.org/genres/'' should be a
 listing of all the genres (the taxonomy terms) that have been added to
 that taxonomy. Presumably, the UX would then allow users to drill down to
 the individual term archive pages, such as ''https://my-movie-
 db/genres/horror/'', which is already supported in the current hierarchy.

 However, as @rileypaulsen points out, all other templates list ''posts''
 not ''taxonomy terms'', so there's a bit of a paradigm-bending shift here.
 Personally, I don't see it as a major issue, but this could be one reason
 we haven't seen this implemented in core yet.

 The second issue is a bit stickier - the naming convention within the
 template hierarchy, because ''taxonomy-$taxonomyname.php'' is already in
 the hierarchy and is the term-agnostic taxonomy-term archive template (the
 less specific fallback to ''taxonomy-$taxonomyname-$termslug.php''
 template). This would have been the most intuitive naming convention.

 I think the issues in the preceding paragraphs can be mostly resolved with
 the following naming convention: ''taxonomy-terms-$taxonomyname.php'' and
 ''taxonomy-terms.php''. The only outstanding issue is that this couldn't
 logically roll up to ''archive.php'', since that's exclusively for posts.
 We would probably need to add a top-level ''term-archive.php'' template,
 and I wonder whether this is the reason this ticket has never made it to a
 patch or a core feature list.

 I'm willing to work up a patch, but would love to hear from a core
 committer, whether this is a non-starter before I invest the time.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/13816#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list