WordPress 4.3+ 默认开启页面的评论功能

WordPress 4.3 及后续版本将页面(page)的功能默认关闭了,也就是说,你如果新建页面,需要手动勾选”允许评论”才可以开启页面的评论功能,这个对于经常要发布可评论页面的用户来说,无疑增加了操作量。

WordPress 4.3+ 默认开启页面的评论功能

如果你想要默认开启页面的评论功能,那你可以下载安装 Allow Comments on Pages by Default 插件,或者将下面的代码添加到 即可:

/*
Plugin Name: Allow Comments on Pages by Default
Plugin URI: http://wordpress.org/plugins/allow-comments-on-pages-by-default/
Description: Turns on comments on pages in WordPress 4.3+ by default.
Author: Sergey Biryukov
Author URI: http://sergeybiryukov.ru/
Version: 1.0
*/
function wp33516_open_comments_for_pages( $status, $post_type, $comment_type ) {
    if ( 'page' === $post_type ) {
        $status = 'open';
    }
    return $status;
}
add_filter( 'get_default_comment_status', 'wp33516_open_comments_for_pages', 10, 3 );