mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-01 21:21:24 +01:00
Comments: In comment_form()
, bail early if comments for the post are closed.
Props jipmoors. Fixes #38514. Built from https://develop.svn.wordpress.org/trunk@38959 git-svn-id: http://core.svn.wordpress.org/trunk@38902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bc5c87710e
commit
919f08fd2d
@ -2167,6 +2167,18 @@ function comment_form( $args = array(), $post_id = null ) {
|
||||
if ( null === $post_id )
|
||||
$post_id = get_the_ID();
|
||||
|
||||
// Exit the function when comments for the post are closed.
|
||||
if ( ! comments_open( $post_id ) ) {
|
||||
/**
|
||||
* Fires after the comment form if comments are closed.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
do_action( 'comment_form_comments_closed' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$commenter = wp_get_current_commenter();
|
||||
$user = wp_get_current_user();
|
||||
$user_identity = $user->exists() ? $user->display_name : '';
|
||||
@ -2252,8 +2264,6 @@ function comment_form( $args = array(), $post_id = null ) {
|
||||
// Ensure that the filtered args contain all required default values.
|
||||
$args = array_merge( $defaults, $args );
|
||||
|
||||
if ( comments_open( $post_id ) ) : ?>
|
||||
<?php
|
||||
/**
|
||||
* Fires before the comment form.
|
||||
*
|
||||
@ -2443,18 +2453,11 @@ function comment_form( $args = array(), $post_id = null ) {
|
||||
<?php endif; ?>
|
||||
</div><!-- #respond -->
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Fires after the comment form.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
do_action( 'comment_form_after' );
|
||||
else :
|
||||
/**
|
||||
* Fires after the comment form if comments are closed.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
do_action( 'comment_form_comments_closed' );
|
||||
endif;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-alpha-38958';
|
||||
$wp_version = '4.7-alpha-38959';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user