From df78f7dc6df647f70f002eb79f7b4edbeecce573 Mon Sep 17 00:00:00 2001 From: davidbaumwald Date: Tue, 21 Oct 2025 14:00:27 +0000 Subject: [PATCH] Comments: Ensure custom comment form fields appear for logged-in users When a user is logged in, only the default comment textarea is shown by the core `comment_form()` implementation, but custom fields supplied via the `fields` argument are omitted. This mismatch means plugin- and theme-added fields aren't visible to logged-in users, though they are visible to guests. This change fixes this by moving the loop over `$args['fields']` inside `comment_form()`, so that extra fields are rendered, regardless of login status. Props maorb, valendesigns, CarlSteffen, swissspidy, rachelbaker, kushsharma, abcd95, iamadisingh, oglekler, welcher. Fixes #16576. Built from https://develop.svn.wordpress.org/trunk@61034 git-svn-id: http://core.svn.wordpress.org/trunk@60370 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 4 +++- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 143920f3c3..2499c25522 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -2593,6 +2593,8 @@ function comment_form( $args = array(), $post = null ) { } } + $original_fields = $fields; + /** * Filters the default comment form fields. * @@ -2806,7 +2808,7 @@ function comment_form( $args = array(), $post = null ) { echo $args['comment_notes_after']; - } elseif ( ! is_user_logged_in() ) { + } elseif ( ! is_user_logged_in() || ! isset( $original_fields[ $name ] ) ) { if ( $first_field === $name ) { /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 0864d73785..6a39455a73 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-alpha-61033'; +$wp_version = '6.9-alpha-61034'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.