From 3778b1eb826df3e8907a51c4f150e98e901be853 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 11 Dec 2019 22:12:09 +0000 Subject: [PATCH] Comments: Avoid a PHP notice in `comment_form()` if the `email` field is not set. Follow-up to [46090]. Props mat-lipe. Fixes #48943. git-svn-id: https://develop.svn.wordpress.org/trunk@46885 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment-template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php index 6f28e2bdb4..2ed2a32cd3 100644 --- a/src/wp-includes/comment-template.php +++ b/src/wp-includes/comment-template.php @@ -2433,7 +2433,7 @@ function comment_form( $args = array(), $post_id = null ) { $args = array_merge( $defaults, $args ); // Remove aria-describedby from the email field if there's no associated description. - if ( false === strpos( $args['comment_notes_before'], 'id="email-notes"' ) ) { + if ( isset( $args['fields']['email'] ) && false === strpos( $args['comment_notes_before'], 'id="email-notes"' ) ) { $args['fields']['email'] = str_replace( ' aria-describedby="email-notes"', '',