Bundled Theme: Update `twenty_twenty_one_password_form` function to actually use a `$post` parameter.

The `twentytwentyone` filtered `the_password_form` with a `twenty_twenty_one_password_form` callback that, by default, passed only one parameter that was assumed to be the post or post ID.  However, the first parameter for `the_password_form` is the filtered output value.  This fix updates both the filter reference and callback to use two parameters: `$output` and `$post`. 

Props burhandodhy, mukesh27.
Fixes #53091.
Built from https://develop.svn.wordpress.org/trunk@50841


git-svn-id: http://core.svn.wordpress.org/trunk@50450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
davidbaumwald 2021-05-11 18:26:01 +00:00
parent 9cd6547f13
commit 2e762721b1
2 changed files with 7 additions and 4 deletions

View File

@ -387,11 +387,14 @@ function twenty_twenty_one_print_first_instance_of_block( $block_name, $content
* Retrieve protected post password form content.
*
* @since Twenty Twenty-One 1.0
* @since Twenty Twenty-One 1.4 Corrected parameter name for `$output`,
* added the `$post` parameter.
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
* @param string $output The password form HTML output.
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
* @return string HTML content for password form for password protected post.
*/
function twenty_twenty_one_password_form( $post = 0 ) {
function twenty_twenty_one_password_form( $output, $post = 0 ) {
$post = get_post( $post );
$label = 'pwbox-' . ( empty( $post->ID ) ? wp_rand() : $post->ID );
$output = '<p class="post-password-message">' . esc_html__( 'This content is password protected. Please enter a password to view.', 'twentytwentyone' ) . '</p>
@ -400,7 +403,7 @@ function twenty_twenty_one_password_form( $post = 0 ) {
';
return $output;
}
add_filter( 'the_password_form', 'twenty_twenty_one_password_form' );
add_filter( 'the_password_form', 'twenty_twenty_one_password_form', 10, 2 );
/**
* Filters the list of attachment image attributes.

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-alpha-50840';
$wp_version = '5.8-alpha-50841';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.