diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 0f7ed846b..b7c3b18e6 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -92,7 +92,13 @@ function edit_post() { if ( 'publish' == $_POST['post_status'] && ! current_user_can('publish_posts') ) $_POST['post_status'] = 'draft'; - + + if ( !isset($_POST['comment_status']) ) + $_POST['comment_status'] = 'closed'; + + if ( !isset($_POST['ping_status']) ) + $_POST['ping_status'] = 'closed'; + if ( !empty($_POST['edit_date']) ) { $aa = $_POST['aa']; $mm = $_POST['mm']; diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index 7339a2680..87c9e1a9a 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -20,12 +20,14 @@ function wp_insert_post($postarr = array()) { } // Get the basics. - $post_content = apply_filters('content_save_pre', $post_content); - $post_excerpt = apply_filters('excerpt_save_pre', $post_excerpt); - $post_title = apply_filters('title_save_pre', $post_title); - $post_category = apply_filters('category_save_pre', $post_category); - $post_status = apply_filters('status_save_pre', $post_status); - $post_name = apply_filters('name_save_pre', $post_name); + $post_content = apply_filters('content_save_pre', $post_content); + $post_excerpt = apply_filters('excerpt_save_pre', $post_excerpt); + $post_title = apply_filters('title_save_pre', $post_title); + $post_category = apply_filters('category_save_pre', $post_category); + $post_status = apply_filters('status_save_pre', $post_status); + $post_name = apply_filters('name_save_pre', $post_name); + $comment_status = apply_filters('comment_status_pre', $comment_status); + $ping_status = apply_filters('ping_status_pre', $ping_status); // Make sure we set a valid category if (0 == count($post_category) || !is_array($post_category)) { @@ -61,9 +63,13 @@ function wp_insert_post($postarr = array()) { if (empty($post_date_gmt)) $post_date_gmt = current_time('mysql', 1); - if (empty($comment_status)) - $comment_status = get_settings('default_comment_status'); - if (empty($ping_status)) + if ( empty($comment_status) ) { + if ( $update ) + $comment_status = 'closed'; + else + $comment_status = get_settings('default_comment_status'); + } + if ( empty($ping_status) ) $ping_status = get_settings('default_ping_status'); if ( empty($post_pingback) ) $post_pingback = get_option('default_pingback_flag');