[wp-trac] [WordPress Trac] #56630: get_terms() does not recognize the 'slug' argument

WordPress Trac noreply at wordpress.org
Mon Sep 26 04:47:22 UTC 2022


#56630: get_terms() does not recognize the 'slug' argument
--------------------------+------------------------------
 Reporter:  NemesisVex    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  6.0.2
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------

Comment (by peterwilsoncc):

 @NemesisVex hello and welcome to trac!

 I've attempted to reproduce this using WordPress 6.0.2 but without
 success. Are you able to check this running a default theme and without
 any plugins enabled?

 This is a dump of running the command within wp-cli, each command returns
 the single term as expected:


 {{{

 wp> get_terms( [ 'taxonomy' => 'custom-taxo', 'slug' => 'term-1'] );
 => phar:///usr/local/src/wp-cli/bin/wp/vendor/wp-cli/shell-
 command/src/WP_CLI/Shell/REPL.php:52:
 array(1) {
   [0] =>
   class WP_Term#2612 (10) {
     public $term_id =>
     int(9)
     public $name =>
     string(6) "Term 1"
     public $slug =>
     string(6) "term-1"
     public $term_group =>
     int(0)
     public $term_taxonomy_id =>
     int(9)
     public $taxonomy =>
     string(11) "custom-taxo"
     public $description =>
     string(0) ""
     public $parent =>
     int(0)
     public $count =>
     int(1)
     public $filter =>
     string(3) "raw"
   }
 }


 wp> get_terms( [ 'taxonomy' => 'custom-taxo', 'slug' => 'term-2'] );
 => phar:///usr/local/src/wp-cli/bin/wp/vendor/wp-cli/shell-
 command/src/WP_CLI/Shell/REPL.php:52:
 array(1) {
   [0] =>
   class WP_Term#2614 (10) {
     public $term_id =>
     int(10)
     public $name =>
     string(6) "term 2"
     public $slug =>
     string(6) "term-2"
     public $term_group =>
     int(0)
     public $term_taxonomy_id =>
     int(10)
     public $taxonomy =>
     string(11) "custom-taxo"
     public $description =>
     string(0) ""
     public $parent =>
     int(0)
     public $count =>
     int(1)
     public $filter =>
     string(3) "raw"
   }
 }


 }}}

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


More information about the wp-trac mailing list