get_default_comment_status

Filters the default comment status for the given post type.

Description

apply_filters( 'get_default_comment_status', (string) $status, (string) $post_type, (string) $comment_type ); 

Parameters (3)

0. $status (string)
Default status for the given post type, either open or closed..
1. $post_type (string)
Post type. Default is post..
2. $comment_type (string)
Type of comment. Default is comment..

Usage

To run the hook, copy the example below.
  1. $status = apply_filters( 'get_default_comment_status', $status, $post_type, $comment_type ); 
  2.  
  3. if ( !empty( $status ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the get_default_comment_status callback 
  2. function filter_get_default_comment_status( $status, $post_type, $comment_type ) { 
  3. // make filter magic happen here... 
  4. return $status
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'get_default_comment_status', 'filter_get_default_comment_status', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'get_default_comment_status', 'filter_get_default_comment_status', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/comment.php  
  1. return apply_filters( 'get_default_comment_status' , $status, $post_type, $comment_type );