Changeset 33122 for trunk/src/wp-includes/post.php
- Timestamp:
- 07/08/2015 03:43:24 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r33054 r33122 4076 4076 4077 4077 /** 4078 * Get the default comment status for a post type.4079 *4080 * @since 4.3.04081 *4082 * @param string $post_type Optional. Post type. Default 'post'.4083 * @param string $comment_type Optional. Comment type. Default 'comment'.4084 * @return string Expected return value is 'open' or 'closed'.4085 */4086 function get_default_comment_status( $post_type = 'post', $comment_type = 'comment' ) {4087 switch ( $comment_type ) {4088 case 'pingback' :4089 case 'trackback' :4090 $supports = 'trackbacks';4091 $option = 'ping';4092 break;4093 default :4094 $supports = 'comments';4095 $option = 'comment';4096 }4097 4098 // Set the status.4099 if ( 'page' === $post_type ) {4100 $status = 'closed';4101 } elseif ( post_type_supports( $post_type, $supports ) ) {4102 $status = get_option( "default_{$option}_status" );4103 } else {4104 $status = 'closed';4105 }4106 4107 /**4108 * Filter the default comment status for the given post type.4109 *4110 * @since 4.3.04111 *4112 * @param string $status Default status for the given post type,4113 * either 'open' or 'closed'.4114 * @param string $post_type Post type. Default is `post`.4115 * @param string $comment_type Type of comment. Default is `comment`.4116 */4117 return apply_filters( 'get_default_comment_status' , $status, $post_type, $comment_type );4118 }4119 4120 /**4121 4078 * Add a URL to those already pinged. 4122 4079 *
Note: See TracChangeset
for help on using the changeset viewer.