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:
parent
23de998e29
commit
bf6f02320a
|
@ -1710,8 +1710,11 @@ function sanitize_term($term, $taxonomy, $context = 'display') {
|
||||||
*/
|
*/
|
||||||
function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
|
function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
|
||||||
$int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' );
|
$int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' );
|
||||||
if ( in_array( $field, $int_fields ) )
|
if ( in_array( $field, $int_fields ) ) {
|
||||||
$value = absint( $value );
|
$value = (int) $value;
|
||||||
|
if ( $value < 0 )
|
||||||
|
$value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( 'raw' == $context )
|
if ( 'raw' == $context )
|
||||||
return $value;
|
return $value;
|
||||||
|
|
Loading…
Reference in New Issue