mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 23:41:38 +01:00
Ensure we don't mangle the array of post ancestors when sanitising a post for editing. Fixes #12168.
git-svn-id: http://svn.automattic.com/wordpress/trunk@13016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5128c1ccc2
commit
41ca2c5621
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user