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

如果你想要默认开启页面的评论功能,那你可以下载安装 Allow Comments on Pages by Default 插件,或者将下面的代码添加到主题的 functions.php 即可:
/*
Plugin Name: Allow Comments on Pages by Default
Plugin URI: https://wordpress.org/plugins/allow-comments-on-pages-by-default/
Description: Turns on comments on pages in <a href="https://www.wpdaxue.com/tag/wordpress-4-3" title="查看与【WordPress 4.3】相关的文章" target="_blank" rel="noopener">WordPress 4.3</a>+ 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 ); |
/*
Plugin Name: Allow Comments on Pages by Default
Plugin URI: https://wordpress.org/plugins/allow-comments-on-pages-by-default/
Description: Turns on comments on pages in <a href="https://www.wpdaxue.com/tag/wordpress-4-3" title="查看与【WordPress 4.3】相关的文章" target="_blank" rel="noopener">WordPress 4.3</a>+ 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 );
来源:
https://www.wpdaxue.com/wordpress-open-comments-for-pages.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_32382.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57