get_default_comment_status
Filters the default comment status for the given post type.
Использование
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(строка)
- Default status for the given post type, either 'open' or 'closed'.
- $post_type(строка)
- Post type.
По умолчанию: post - $comment_type(строка)
- Type of comment.
По умолчанию: comment
Список изменений
С версии 4.3.0 | Введена. |
Где вызывается хук
get_default_comment_status
wp-includes/comment.php 315
return apply_filters( 'get_default_comment_status', $status, $post_type, $comment_type );