From 82227c9fa6e0165ae6869c0d8302c1cc78a83f76 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 28 Oct 2020 16:55:42 +0000 Subject: [PATCH] General: Ensure that filtered arguments in `get_search_form()` contain all required default values. Props kellybleck, davidbaumwald, whyisjake, SergeyBiryukov. Fixes #51645. git-svn-id: https://develop.svn.wordpress.org/trunk@49355 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment-template.php | 2 +- src/wp-includes/general-template.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php index 943113605c..e6b246cf14 100644 --- a/src/wp-includes/comment-template.php +++ b/src/wp-includes/comment-template.php @@ -2499,7 +2499,7 @@ function comment_form( $args = array(), $post_id = null ) { */ $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); - // Ensure that the filtered args contain all required default values. + // Ensure that the filtered arguments contain all required default values. $args = array_merge( $defaults, $args ); // Remove `aria-describedby` from the email field if there's no associated description. diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 15c4974304..94e2d1b97d 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -281,6 +281,9 @@ function get_search_form( $args = array() ) { */ $args = apply_filters( 'search_form_args', $args ); + // Ensure that the filtered arguments contain all required default values. + $args = array_merge( $defaults, $args ); + $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml'; /** @@ -303,7 +306,7 @@ function get_search_form( $args = array() ) { $form = ob_get_clean(); } else { // Build a string containing an aria-label to use for the search form. - if ( isset( $args['aria_label'] ) && $args['aria_label'] ) { + if ( $args['aria_label'] ) { $aria_label = 'aria-label="' . esc_attr( $args['aria_label'] ) . '" '; } else { /*