Posts, Post Types: Fix option validation in `stick_post()`.

Normalize an invalid `sticky_posts` option to an empty array within `stick_post()`. This fixes a bug in which an unexpected option value would prevent new posts from being made sticky.

Follow up to [50380].

Props azouamauriac, denishua, kajalgohel, sergeybiryukov, costdev.
Fixes #55176.


Built from https://develop.svn.wordpress.org/trunk@53238


git-svn-id: http://core.svn.wordpress.org/trunk@52827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2022-04-21 06:04:15 +00:00
parent 7821c369eb
commit 7082f4dc84
2 changed files with 2 additions and 2 deletions

View File

@ -2895,7 +2895,7 @@ function stick_post( $post_id ) {
$updated = false;
if ( ! is_array( $stickies ) ) {
$stickies = array( $post_id );
$stickies = array();
} else {
$stickies = array_unique( array_map( 'intval', $stickies ) );
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-beta2-53237';
$wp_version = '6.0-beta2-53238';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.