WordPress.org

Make WordPress Core

Ticket #12991: default_page_comments2.patch

File default_page_comments2.patch, 2.2 KB (added by messenlehner, 8 years ago)

Update for setting default comments on or off for pages

  • wp-admin/includes/post.php

     
    379379                $post->post_status = 'draft';
    380380                $post->to_ping = '';
    381381                $post->pinged = '';
    382                 $post->comment_status = get_option( 'default_comment_status' );
     382                if ( "page" == $post_type ) {
     383                        $post->comment_status = get_option( 'default_comment_status_pages' );
     384                } else {
     385                        $post->comment_status = get_option( 'default_comment_status' );
     386                }
    383387                $post->ping_status = get_option( 'default_ping_status' );
    384388                $post->post_pingback = get_option( 'default_pingback_flag' );
    385389                $post->post_category = get_option( 'default_category' );
  • wp-admin/options-discussion.php

     
    4242<?php _e('Allow people to post comments on new articles') ?></label>
    4343<br />
    4444<small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
     45<br />
     46<label for="default_comment_status_pages">
     47<input name="default_comment_status_pages" type="checkbox" id="default_comment_status_pages" value="open" <?php checked('open', get_option('default_comment_status_pages')); ?> />
     48<?php _e('Allow people to post comments on new pages') ?></label>
     49<br />
     50<small><em><?php echo '(' . __('These settings may be overridden for individual pages.') . ')'; ?></em></small>
    4551</fieldset></td>
    4652</tr>
    4753<tr valign="top">
  • wp-includes/post.php

     
    21592159                if ( $update )
    21602160                        $comment_status = 'closed';
    21612161                else
    2162                         $comment_status = get_option('default_comment_status');
     2162                        if ( "page" == $post_type ) {
     2163                                $comment_status = get_option( 'default_comment_status_pages' );
     2164                        } else {
     2165                                $comment_status = get_option( 'default_comment_status' );
     2166                        }
    21632167        }
    21642168        if ( empty($ping_status) )
    21652169                $ping_status = get_option('default_ping_status');