[wp-trac] [WordPress Trac] #44466: Have a method to check if a taxonomy is viewable

WordPress Trac noreply at wordpress.org
Tue Jun 26 15:10:38 UTC 2018


#44466: Have a method to check if a taxonomy is viewable
-------------------------------------------------+-------------------------
 Reporter:  andizer                              |       Owner:  andizer
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.0
Component:  Taxonomy                             |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  needs-unit-tests good-first-bug      |     Focuses:
  has-patch                                      |
-------------------------------------------------+-------------------------
Changes (by flixos90):

 * keywords:  needs-patch needs-unit-tests good-first-bug => needs-unit-
     tests good-first-bug has-patch
 * owner:  (none) => andizer
 * status:  new => assigned


Comment:

 Thanks for the patch @andizer!

 I think two small changes are needed:
 * For taxonomies, we only need to check `publicly_queryable` in any case.
 The only reason `is_post_type_viewable()` contains the extra logic is
 because of the special case of pages being public but not publicly
 queryable. This doesn't exist for taxonomies in core, so we can simplify
 here.
 * We don't need the `isset()` checks as these properties always are set on
 taxonomy objects.

 Let me know if you wanna work on unit tests for this as well. For now I'll
 assign it to you for further iteration.

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


More information about the wp-trac mailing list