get_default_comment_status
Filter HookDescription
Filters the default comment status for the given post type.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Filter |
Line Number | 335 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$status
|
Default status for the given post type, either 'open' or 'closed'. |
string
|
$post_type
|
Post type. Default is `post`. |
string
|
$comment_type
|
Type of comment. Default is `comment`. |
Usage Examples
Basic Usage
<?php
// Hook into get_default_comment_status
add_filter('get_default_comment_status', 'my_custom_filter', 10, 3);
function my_custom_filter($status, $post_type, $comment_type) {
// Your custom filtering logic here
return $status;
}
Source Code Context
wp-includes/comment.php:335
- How this hook is used in WordPress core
<?php
330 * @param string $status Default status for the given post type,
331 * either 'open' or 'closed'.
332 * @param string $post_type Post type. Default is `post`.
333 * @param string $comment_type Type of comment. Default is `comment`.
334 */
335 return apply_filters( 'get_default_comment_status', $status, $post_type, $comment_type );
336 }
337
338 /**
339 * Retrieves the date the last comment was modified.
340 *
PHP Documentation
<?php
/**
* Filters the default comment status for the given post type.
*
* @since 4.3.0
*
* @param string $status Default status for the given post type,
* either 'open' or 'closed'.
* @param string $post_type Post type. Default is `post`.
* @param string $comment_type Type of comment. Default is `comment`.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/comment.php
Related Hooks
Related hooks will be displayed here in future updates.