diff --git a/wp-includes/post.php b/wp-includes/post.php index 82d8cdc87c..328198732d 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1199,7 +1199,6 @@ function sanitize_post($post, $context = 'display') { $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context); $post['filter'] = $context; } - return $post; } @@ -1235,6 +1234,13 @@ function sanitize_post_field($field, $value, $post_id, $context) { if ( in_array($field, $int_fields) ) $value = (int) $value; + // Fields which contain arrays of ints. + $array_int_fields = array( 'ancestors' ); + if ( in_array($field, $array_int_fields) ) { + $value = array_map( 'absint', $value); + return $value; + } + if ( 'raw' == $context ) return $value;