[wp-trac] Re: [WordPress Trac] #8803: get_category_by_slug doesnt work

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 6 00:57:32 GMT 2009


#8803: get_category_by_slug doesnt work
-------------------------------+--------------------------------------------
 Reporter:  security_man       |        Owner:  anonymous
     Type:  defect (bug)       |       Status:  new      
 Priority:  normal             |    Milestone:  2.8      
Component:  General            |      Version:  2.6.1    
 Severity:  normal             |   Resolution:           
 Keywords:  reporter-feedback  |  
-------------------------------+--------------------------------------------
Changes (by DD32):

  * keywords:  => reporter-feedback

Comment:

 Seems to work for me:
 {{{
 <?php

 var_dump(get_category_by_slug('general'));

 ?>
 object(stdClass)[169]
   public 'term_id' => &string '4' (length=1)
   public 'name' => &string 'General' (length=7)
   public 'slug' => &string 'general' (length=7)
   public 'term_group' => string '0' (length=1)
   public 'term_taxonomy_id' => string '4' (length=1)
   public 'taxonomy' => string 'category' (length=8)
   public 'description' => &string '' (length=0)
   public 'parent' => &string '0' (length=1)
   public 'count' => &string '13' (length=2)
   public 'cat_ID' => &string '4' (length=1)
   public 'category_count' => &string '13' (length=2)
   public 'category_description' => &string '' (length=0)
   public 'cat_name' => &string 'General' (length=7)
   public 'category_nicename' => &string 'general' (length=7)
   public 'category_parent' => &string '0' (length=1)
 }}}

 However, Going off your second paragraph, Are you referring to Link
 Categories? If So, {{{get_category_by_slug()}}}} is only for post
 categories, not for link categories. (Was it ever different?)

 Next, {{{wp_get_bookmarks()}}}.. I guess you mean {{{get_bookmarks()}}} ?

 In which case, That works for me too:
 {{{
 <?php

 var_dump(get_bookmarks('category_name=Blogroll'));

 ?>
 array
   0 =>
     object(stdClass)[154]
       public 'link_id' => string '2' (length=1)
       public 'link_url' => string 'http://wordpress.org/development/'
 (length=33)
       public 'link_name' => string 'Development Blog' (length=16)
       public 'link_image' => string '' (length=0)
       public 'link_target' => string '' (length=0)
       public 'link_category' => string '0' (length=1)
       public 'link_description' => string '' (length=0)
       public 'link_visible' => string 'Y' (length=1)
       public 'link_owner' => string '1' (length=1)
       public 'link_rating' => string '0' (length=1)
       public 'link_updated' => string '0000-00-00 00:00:00' (length=19)
       public 'link_rel' => string '' (length=0)
       public 'link_notes' => string '' (length=0)
       public 'link_rss' => string 'http://wordpress.org/development/feed/'
 (length=38)
       public 'object_id' => string '2' (length=1)
       public 'term_taxonomy_id' => string '2' (length=1)
       public 'term_order' => string '0' (length=1)
       public 'term_id' => string '2' (length=1)
       public 'taxonomy' => string 'link_category' (length=13)
       public 'description' => string '' (length=0)
       public 'parent' => string '0' (length=1)
       public 'count' => string '8' (length=1)
       public 'recently_updated' => string '0' (length=1)
 }}}

 I'd suggest disabling all your plugins and trying again, AFAIK nothing was
 changed related to links/bookmarks between 2.6.3 and 2.6.5 to start with.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8803#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list