diff --git a/wp-includes/post.php b/wp-includes/post.php index 526d8f7f36..b46d97bf14 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2626,19 +2626,19 @@ function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) { function stick_post( $post_id ) { $post_id = (int) $post_id; $stickies = get_option( 'sticky_posts' ); + $updated = false; if ( ! is_array( $stickies ) ) { - $stickies = array(); + $stickies = array( $post_id ); + } else { + $stickies = array_unique( array_map( 'intval', $stickies ) ); } - $stickies = array_map( 'intval', $stickies ); - if ( ! in_array( $post_id, $stickies, true ) ) { $stickies[] = $post_id; + $updated = update_option( 'sticky_posts', array_values( $stickies ) ); } - $updated = update_option( 'sticky_posts', $stickies ); - if ( $updated ) { /** * Fires once a post has been added to the sticky list. @@ -2668,7 +2668,7 @@ function unstick_post( $post_id ) { return; } - $stickies = array_map( 'intval', $stickies ); + $stickies = array_values( array_unique( array_map( 'intval', $stickies ) ) ); if ( ! in_array( $post_id, $stickies, true ) ) { return; diff --git a/wp-includes/version.php b/wp-includes/version.php index 7418cc09c8..2fcc767d05 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-beta3-50379'; +$wp_version = '5.7-beta3-50380'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.