Use `get_default_comment_status()` globally.

Also makes the filter name static and passes the post type for context.

Props valendesigns.
Fixes #31168.



git-svn-id: https://develop.svn.wordpress.org/trunk@33054 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Obenland 2015-07-02 22:31:58 +00:00
parent 9532df3c9f
commit bfbdb6f0b2
4 changed files with 16 additions and 15 deletions

View File

@ -610,8 +610,8 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
$post->post_status = 'draft';
$post->to_ping = '';
$post->pinged = '';
$post->comment_status = get_option( 'default_comment_status' );
$post->ping_status = get_option( 'default_ping_status' );
$post->comment_status = get_default_comment_status( $post_type );
$post->ping_status = get_default_comment_status( $post_type, 'pingback' );
$post->post_pingback = get_option( 'default_pingback_flag' );
$post->post_category = get_option( 'default_category' );
$post->page_template = 'default';

View File

@ -129,8 +129,8 @@ case 'post-quickdraft-save':
$post = get_post( $_REQUEST['post_ID'] );
check_admin_referer( 'add-' . $post->post_type );
$_POST['comment_status'] = get_option( 'default_comment_status' );
$_POST['ping_status'] = get_option( 'default_ping_status' );
$_POST['comment_status'] = get_default_comment_status( $post->post_type );
$_POST['ping_status'] = get_default_comment_status( $post->post_type, 'pingback' );
edit_post();
wp_dashboard_quick_press();

View File

@ -4809,7 +4809,7 @@ class wp_xmlrpc_server extends IXR_Server {
$comment_status = 'open';
break;
default:
$comment_status = get_option('default_comment_status');
$comment_status = get_default_comment_status( $post_type );
break;
}
} else {
@ -4822,12 +4822,12 @@ class wp_xmlrpc_server extends IXR_Server {
$comment_status = 'open';
break;
default:
$comment_status = get_option('default_comment_status');
$comment_status = get_default_comment_status( $post_type );
break;
}
}
} else {
$comment_status = get_option('default_comment_status');
$comment_status = get_default_comment_status( $post_type );
}
if ( isset($content_struct['mt_allow_pings']) ) {
@ -4840,7 +4840,7 @@ class wp_xmlrpc_server extends IXR_Server {
$ping_status = 'open';
break;
default:
$ping_status = get_option('default_ping_status');
$ping_status = get_default_comment_status( $post_type, 'pingback' );
break;
}
} else {
@ -4852,12 +4852,12 @@ class wp_xmlrpc_server extends IXR_Server {
$ping_status = 'open';
break;
default:
$ping_status = get_option('default_ping_status');
$ping_status = get_default_comment_status( $post_type, 'pingback' );
break;
}
}
} else {
$ping_status = get_option('default_ping_status');
$ping_status = get_default_comment_status( $post_type, 'pingback' );
}
if ( $post_more )
@ -5120,7 +5120,7 @@ class wp_xmlrpc_server extends IXR_Server {
$comment_status = 'open';
break;
default:
$comment_status = get_option('default_comment_status');
$comment_status = get_default_comment_status( $post_type );
break;
}
} else {
@ -5133,7 +5133,7 @@ class wp_xmlrpc_server extends IXR_Server {
$comment_status = 'open';
break;
default:
$comment_status = get_option('default_comment_status');
$comment_status = get_default_comment_status( $post_type );
break;
}
}
@ -5149,7 +5149,7 @@ class wp_xmlrpc_server extends IXR_Server {
$ping_status = 'open';
break;
default:
$ping_status = get_option('default_ping_status');
$ping_status = get_default_comment_status( $post_type, 'pingback' );
break;
}
} else {
@ -5161,7 +5161,7 @@ class wp_xmlrpc_server extends IXR_Server {
$ping_status = 'open';
break;
default:
$ping_status = get_option('default_ping_status');
$ping_status = get_default_comment_status( $post_type, 'pingback' );
break;
}
}

View File

@ -4111,9 +4111,10 @@ function get_default_comment_status( $post_type = 'post', $comment_type = 'comme
*
* @param string $status Default status for the given post type,
* either 'open' or 'closed'.
* @param string $post_type Post type. Default is `post`.
* @param string $comment_type Type of comment. Default is `comment`.
*/
return apply_filters( "get_{$post_type}_default_comment_status", $status, $comment_type );
return apply_filters( 'get_default_comment_status' , $status, $post_type, $comment_type );
}
/**