WordPress.org

Make WordPress Core

Changeset 50841


Ignore:
Timestamp:
05/11/2021 06:24:38 PM (7 months ago)
Author:
davidbaumwald
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentyone/inc/template-functions.php

    r49930 r50841  
    388388 *
    389389 * @since Twenty Twenty-One 1.0
    390  *
    391  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
     390 * @since Twenty Twenty-One 1.4 Corrected parameter name for `$output`,
     391 *                              added the `$post` parameter.
     392 *
     393 * @param string      $output The password form HTML output.
     394 * @param int|WP_Post $post   Optional. Post ID or WP_Post object. Default is global $post.
    392395 * @return string HTML content for password form for password protected post.
    393396 */
    394 function twenty_twenty_one_password_form( $post = 0 ) {
     397function twenty_twenty_one_password_form( $output, $post = 0 ) {
    395398    $post   = get_post( $post );
    396399    $label  = 'pwbox-' . ( empty( $post->ID ) ? wp_rand() : $post->ID );
     
    401404    return $output;
    402405}
    403 add_filter( 'the_password_form', 'twenty_twenty_one_password_form' );
     406add_filter( 'the_password_form', 'twenty_twenty_one_password_form', 10, 2 );
    404407
    405408/**
Note: See TracChangeset for help on using the changeset viewer.