Definition:
function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {}
Cleanse the field value in the term based on the context.
Passing a term field value through the function should be assumed to have cleansed the value for whatever context the term field is going to be used.
Parameters
- string $field: Term field to sanitize
- string $value: Search for this term value
- int $term_id: Term ID
- string $taxonomy: Taxonomy Name
- string $context: Either edit, db, display, attribute, or js.
Return values
returns:sanitized field
Defined filters
- edit_term_{$field}
apply_filters("edit_term_{$field}", $value, $term_id, $taxonomy) - edit_{$taxonomy}_{$field}
apply_filters("edit_{$taxonomy}_{$field}", $value, $term_id)
Source code
function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
if ( 'parent' == $field || 'term_id' == $field || 'count' == $field || 'term_group' == $field ) {
$value = (int) $value;
if ( $value < 0 )
$value = 0;
}
if ( 'raw' == $context )
return $value;
if ( 'edit' == $context ) {
$value = apply_filters("edit_term_{$field}", $value, $term_id, $taxonomy);
$value = apply_filters("edit_{$taxonomy}_{$field}", $value, $term_id);
2787

February 12, 2011 


No comments yet... Be the first to leave a reply!