[wp-trac] [WordPress Trac] #61957: Taxonomies: Allow querying for all posts with any term of a given taxonomy

WordPress Trac noreply at wordpress.org
Thu Aug 29 13:19:31 UTC 2024


#61957: Taxonomies: Allow querying for all posts with any term of a given taxonomy
-----------------------------+-----------------------------
 Reporter:  Bernhard Reiter  |      Owner:  (none)
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Taxonomy         |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Consider an example taxonomy, e.g. `projects`, with possible terms `film`,
 `tv`, etc.

 Upon registering such a taxonomy -- and creating those terms -- WordPress
 provides us with routes, such as `/projects/film` and `/projects/tv`,
 which will display all posts that have those respective terms assigned.

 However, there's no straight-forward way to show all posts that have
 ''any'' term from the `projects` taxonomy assigned (in this example: all
 film and tv projects at once). Instead, depending on the chosen permalink
 structure, the `/projects` route will be typically understood by WP as the
 slug of a page or post; and if no page or post with such a slug exists, it
 will 404.

 I believe that there might be a need to support such a "root taxonomy
 route" -- for lack of a better word. In terms of
 [https://developer.wordpress.org/themes/basics/template-hierarchy/
 template resolution], that route should use all the matching taxonomy
 related templates (i.e. `taxonomy-$taxonomy`, `taxonomy`, `archive`, and
 `index`). This applies to both Classic Themes, and Block Themes.

 Permalinks in WordPress are, of course, not the canonical representation
 of routes; query strings are. For example, `/projects/film` translates to
 `?projects=film`. Fortunately, while syntax like `?projects=` (with no
 value assigned) or simply `?projects` is currently not supported by WP,
 they [https://stackoverflow.com/questions/4557387/is-a-url-query-
 parameter-valid-if-it-has-no-value aren't strictly disallowed by the URI
 RFC].

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61957>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list