Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#5253 closed defect (bug) (fixed)

filter category_description call too many (2) in category_description() function

Reported by: michelwp's profile michelwp Owned by:
Milestone: 2.5 Priority: high
Severity: normal Version: 2.3
Component: General Keywords: sanitize_term_field get_term_field needs-patch
Focuses: Cc:


Continuing the taxomony exploration (#5245) for multilingual tests (, I discover that the filter category_description was called two times. After uneasy research, I found that the origin is that
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);

Change History (3)

#1 @ryan
16 years ago

(In [6311]) Fix raw context filtering for terms. see #5253

#2 @ryan
16 years ago

Does that help?

#3 @westi
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

No feedback for 4 months closing as fixed.

Please reopen if this is still an issue.

Note: See TracTickets for help on using tickets.