[wp-trac] [WordPress Trac] #63488: Wrong return value for get_category_by_path()

WordPress Trac noreply at wordpress.org
Tue May 27 15:07:11 UTC 2025


#63488: Wrong return value for get_category_by_path()
--------------------------+------------------------------
 Reporter:  milana_cap    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  docs
--------------------------+------------------------------

Comment (by sabernhardt):

 [6125] added an `is_wp_error()` check. If I read the conditions correctly,
 it could receive an error from `get_term()` if the `$category` is a valid
 subcategory with an invalid parent ID (maybe because the parent term was
 deleted?).

 If `$curcategory` never produces an error (anymore), the
 [https://github.com/WordPress/wordpress-
 develop/blob/666ebd8731818af64f135a28aaffb90881b7ed8c/src/wp-
 includes/category.php#L157-L160 is_wp_error condition] could be removed
 too. Otherwise, the documentation should continue to mention `WP_Error`.

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


More information about the wp-trac mailing list