[wp-trac] [WordPress Trac] #5253: filter category_description call too many (2) in category_description() function

WordPress Trac wp-trac at lists.automattic.com
Wed Oct 24 16:53:54 GMT 2007


#5253: filter category_description call too many (2) in category_description()
function
----------------------+-----------------------------------------------------
 Reporter:  michelwp  |       Owner:  anonymous                                     
     Type:  defect    |      Status:  new                                           
 Priority:  high      |   Milestone:  2.4                                           
Component:  General   |     Version:  2.3                                           
 Severity:  normal    |    Keywords:  sanitize_term_field get_term_field needs-patch
----------------------+-----------------------------------------------------
 Continuing the taxomony exploration (#5245) for multilingual tests
 (dev.xiligroup.com), I discover that the filter ''category_description''
 was called '''two''' times. After uneasy research, I found that the origin
 is that [[BR]]
 in '''get_term_field('description', $category, 'category')''' the function
 sanitize_term_field() was called ''one time too much'' : one by get_term
 and one for the field in the return...


 {{{
 function get_term_field( $field, $term, $taxonomy, $context = 'display' )
 {
         $term = (int) $term;
         $term = get_term( $term, $taxonomy ); /* ------- sanitize here
 ?????? */
         if ( is_wp_error($term) )
                 return $term;

         if ( !is_object($term) )
                 return '';

         if ( !isset($term->$field) )
                 return '';
 /* or here - need to choose */
         return sanitize_term_field($field, $term->$field, $term->term_id,
 $taxonomy, $context);
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5253>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list