Action hook 'comment_form_comments_closed'

in WP Core File wp-includes/comment-template.php at line 2511

View Source

comment_form_comments_closed

Action Hook
Description
Fires after the comment form if comments are closed. For backward compatibility, this action also fires if comment_form() is called with an invalid post object or ID.

Hook Information

File Location wp-includes/comment-template.php View on GitHub
Hook Type Action
Line Number 2511

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into comment_form_comments_closed
add_action('comment_form_comments_closed', 'my_custom_function');

function my_custom_function() {
    // Your custom code here
}

Source Code Context

wp-includes/comment-template.php:2511 - How this hook is used in WordPress core
<?php
2506  		 * For backward compatibility, this action also fires if comment_form()
2507  		 * is called with an invalid post object or ID.
2508  		 *
2509  		 * @since 3.0.0
2510  		 */
2511  		do_action( 'comment_form_comments_closed' );
2512  
2513  		return;
2514  	}
2515  
2516  	$post_id       = $post->ID;

PHP Documentation

<?php
/**
		 * Fires after the comment form if comments are closed.
		 *
		 * For backward compatibility, this action also fires if comment_form()
		 * is called with an invalid post object or ID.
		 *
		 * @since 3.0.0
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 0
  • File: wp-includes/comment-template.php
Related Hooks

Related hooks will be displayed here in future updates.