diff --git a/wp-includes/post.php b/wp-includes/post.php index ed95625d10..81d152f638 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2633,6 +2633,11 @@ function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) { } } + // Restore the type for integer fields after esc_attr(). + if ( in_array( $field, $int_fields, true ) ) { + $value = (int) $value; + } + return $value; } diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 1de90cf877..7d7785407c 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1760,6 +1760,12 @@ function sanitize_term_field( $field, $value, $term_id, $taxonomy, $context ) { } elseif ( 'js' === $context ) { $value = esc_js( $value ); } + + // Restore the type for integer fields after esc_attr(). + if ( in_array( $field, $int_fields, true ) ) { + $value = (int) $value; + } + return $value; } diff --git a/wp-includes/user.php b/wp-includes/user.php index 13c1542e86..4de8b12b3c 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -1530,6 +1530,12 @@ function sanitize_user_field( $field, $value, $user_id, $context ) { } elseif ( 'js' === $context ) { $value = esc_js( $value ); } + + // Restore the type for integer fields after esc_attr(). + if ( in_array( $field, $int_fields, true ) ) { + $value = (int) $value; + } + return $value; } diff --git a/wp-includes/version.php b/wp-includes/version.php index af494e806b..ca445e437f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-alpha-50934'; +$wp_version = '5.8-alpha-50935'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.