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

WordPress Trac noreply at wordpress.org
Tue May 27 09:56:48 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        |   Keywords:  has-patch
  Focuses:  docs          |
--------------------------+-----------------------------
 The function `get_category_by_path()`,
 [https://developer.wordpress.org/reference/functions/get_category_by_path/]
 claims to return `WP_Term|array|WP_Error|null` but it does not return the
 `WP_Error`.

 Testing:

 {{{#!php
 <?php
 $category = get_category_by_path( 'wrongpath' );
 if ( ! is_wp_error( $category ) ) {
    echo 'not an error';
 }
 }}}

 I've got the string echoed for the non-existent category.

 I created a PR with a patch, but @harishtewari has reported it.

 Report: https://github.com/WordPress/Documentation-Issue-
 Tracker/issues/1908
 PR:

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


More information about the wp-trac mailing list