A negative term parent value should be sanitized to 0, not 1. Fix a regression in sanitize_term_field() caused by [26010].

props mattheu for initial patch.
fixes #25852.
Built from https://develop.svn.wordpress.org/trunk@26028


git-svn-id: http://core.svn.wordpress.org/trunk@25958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2013-11-06 23:41:09 +00:00
parent 23de998e29
commit bf6f02320a

View File

@ -1710,8 +1710,11 @@ function sanitize_term($term, $taxonomy, $context = 'display') {
*/
function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
$int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' );
if ( in_array( $field, $int_fields ) )
$value = absint( $value );
if ( in_array( $field, $int_fields ) ) {
$value = (int) $value;
if ( $value < 0 )
$value = 0;
}
if ( 'raw' == $context )
return $value;