get_default_comment_status
Filters the default comment status for the given post type.
Usage
add_filter( 'get_default_comment_status', 'wp_kama_get_default_comment_status_filter', 10, 3 ); /** * Function for `get_default_comment_status` filter-hook. * * @param string $status Default status for the given post type, either 'open' or 'closed'. * @param string $post_type Post type. * @param string $comment_type Type of comment. * * @return string */ function wp_kama_get_default_comment_status_filter( $status, $post_type, $comment_type ){ // filter... return $status; }
- $status(string)
- Default status for the given post type, either 'open' or 'closed'.
- $post_type(string)
- Post type.
Default: post - $comment_type(string)
- Type of comment.
Default: comment
Changelog
Since 4.3.0 | Introduced. |
Where the hook is called
get_default_comment_status
wp-includes/comment.php 315
return apply_filters( 'get_default_comment_status', $status, $post_type, $comment_type );