[wp-trac] [WordPress Trac] #28232: Custom Taxonomy filter on post listing pages

WordPress Trac noreply at wordpress.org
Tue Jun 16 13:01:03 UTC 2015

#28232: Custom Taxonomy filter on post listing pages
 Reporter:  jtsternberg  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Taxonomy     |     Version:  4.0
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
Changes (by boonebgorges):

 * keywords:  has-patch needs-refresh => needs-patch


 This seems like a good feature to me. A few comments on

 * `sprintf( __( 'Filter by %s' ), $taxonomy->labels->singular_name )` is
 not properly localizable, because of the way many languages will decline
 the taxonomy name. If we want the screen-reader-text to match that of the
 Category dropdown, then we'll need a new taxonomy label - something like
 'filter_by_item'. @SergeyBiryukov does this seem right to you?
 * We should pass `'hide_if_empty' => true` to `wp_dropdown_categories()` -
 taxonomies with no terms should not have dropdowns here.
 * Let's use booleans instead of integers when building the
 `wp_dropdown_categories()` argument array. (Never mind that the Category
 dropdown does it the other way.)
 * Not all taxonomies will have a non-false `query_var`, and I don't think
 we need to depend on the existence of `query_var` to make this feature
 work. I recommend doing something like this: if the taxonomy has a non-
 boolean `query_var`, use it; otherwise use `sanitize_title_with_dashes(
 $taxonomy->name )`
 * We need better escaping (`esc_attr()`) in the `<label>` element.
 * Why bother getting the 'objects' from `get_object_taxonomies()` and
 filtering down to 'name' on the next line, only to call `get_taxonomy()`
 in the `foreach` loop? I'd suggest removing the fourth param (`'name'`) in

Ticket URL: <https://core.trac.wordpress.org/ticket/28232#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list