sanitize_category_field

The timeline below displays how wordpress function sanitize_category_field has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Sanitizes data in single category key field.
 *
 * @since 2.3.0
 *
 * @param string $field   Category key to sanitize.
 * @param mixed  $value   Category value to sanitize.
 * @param int    $cat_id  Category ID.
 * @param string $context What filter to use, 'raw', 'display', etc.
 * @return mixed Value after $value has been sanitized.
 */
function sanitize_category_field($field, $value, $cat_id, $context)
{
    return sanitize_term_field($field, $value, $cat_id, 'category', $context);
}

WordPress Version: 5.5

/**
 * Sanitizes data in single category key field.
 *
 * @since 2.3.0
 *
 * @param string $field   Category key to sanitize.
 * @param mixed  $value   Category value to sanitize.
 * @param int    $cat_id  Category ID.
 * @param string $context What filter to use, 'raw', 'display', etc.
 * @return mixed Same type as $value after $value has been sanitized.
 */
function sanitize_category_field($field, $value, $cat_id, $context)
{
    return sanitize_term_field($field, $value, $cat_id, 'category', $context);
}

WordPress Version: 4.1

/**
 * Sanitizes data in single category key field.
 *
 * @since 2.3.0
 *
 * @param string $field Category key to sanitize
 * @param mixed $value Category value to sanitize
 * @param int $cat_id Category ID
 * @param string $context What filter to use, 'raw', 'display', etc.
 * @return mixed Same type as $value after $value has been sanitized.
 */
function sanitize_category_field($field, $value, $cat_id, $context)
{
    return sanitize_term_field($field, $value, $cat_id, 'category', $context);
}

WordPress Version: 3.7

/**
 * Sanitizes data in single category key field.
 *
 * @since 2.3.0
 * @uses sanitize_term_field() See function for more details.
 *
 * @param string $field Category key to sanitize
 * @param mixed $value Category value to sanitize
 * @param int $cat_id Category ID
 * @param string $context What filter to use, 'raw', 'display', etc.
 * @return mixed Same type as $value after $value has been sanitized.
 */
function sanitize_category_field($field, $value, $cat_id, $context)
{
    return sanitize_term_field($field, $value, $cat_id, 'category', $context);
}