如何更改Wordpress管理区域中的默认屏幕选项

时间:2013-07-08 19:55:47

标签: wordpress

在管理区域中编辑页面或帖子时,您可以启用和禁用各种屏幕选项。

我想要实现的目的是使默认情况下不允许发表评论,但如果管理员也愿意,也可以开启。目前默认设置为允许注释。

默认情况下如何将allow comments更改为false(未选中)?

1 个答案:

答案 0 :(得分:1)

只需将其粘贴到functions.php

即可
function comments_off_default( $post_content, $post ) {
    $post->comment_status = 'closed';
    return $post_content;
}
add_filter( 'default_content', 'comments_off_default', 10, 2 );

您也可以尝试this plugin