Changeset 33122 for trunk/src/wp-includes/comment.php
- Timestamp:
- 07/08/2015 03:43:24 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r33021 r33122 1035 1035 1036 1036 /** 1037 * Get the default comment status for a post type. 1038 * 1039 * @since 4.3.0 1040 * 1041 * @param string $post_type Optional. Post type. Default 'post'. 1042 * @param string $comment_type Optional. Comment type. Default 'comment'. 1043 * @return string Expected return value is 'open' or 'closed'. 1044 */ 1045 function get_default_comment_status( $post_type = 'post', $comment_type = 'comment' ) { 1046 switch ( $comment_type ) { 1047 case 'pingback' : 1048 case 'trackback' : 1049 $supports = 'trackbacks'; 1050 $option = 'ping'; 1051 break; 1052 default : 1053 $supports = 'comments'; 1054 $option = 'comment'; 1055 } 1056 1057 // Set the status. 1058 if ( 'page' === $post_type ) { 1059 $status = 'closed'; 1060 } elseif ( post_type_supports( $post_type, $supports ) ) { 1061 $status = get_option( "default_{$option}_status" ); 1062 } else { 1063 $status = 'closed'; 1064 } 1065 1066 /** 1067 * Filter the default comment status for the given post type. 1068 * 1069 * @since 4.3.0 1070 * 1071 * @param string $status Default status for the given post type, 1072 * either 'open' or 'closed'. 1073 * @param string $post_type Post type. Default is `post`. 1074 * @param string $comment_type Type of comment. Default is `comment`. 1075 */ 1076 return apply_filters( 'get_default_comment_status' , $status, $post_type, $comment_type ); 1077 } 1078 1079 /** 1037 1080 * The date the last comment was modified. 1038 1081 *
Note: See TracChangeset
for help on using the changeset viewer.