plugins - Comment restrictions Wodpress

I want to restrict new registered users on my WordPress site from writing comments until 3 days passed their registratio

I want to restrict new registered users on my WordPress site from writing comments until 3 days passed their registration date. What solution do you recommend? thanks in advanced.

I want to restrict new registered users on my WordPress site from writing comments until 3 days passed their registration date. What solution do you recommend? thanks in advanced.

Share Improve this question edited Sep 29, 2019 at 10:01 Salah asked Sep 29, 2019 at 8:31 SalahSalah 11 2
  • Is your site hosted on wordpress? If so: did you ask their support? – fuxia Commented Sep 29, 2019 at 9:22
  • no my cms is wordpress. – Salah Commented Sep 29, 2019 at 10:02
Add a comment  | 

1 Answer 1

Reset to default 0

The comments_open() boolean function return is filtered by 'comments_open'. Untested, pseudo code as a guide:

add_filter( 'comments_open', function( $open ) {
    $user = wp_get_current_user();
    $open = $open && $user && time() - mysql2date( 'U', $user->user_registered ) > 3 * DAY_IN_SECONDS;
    return $open;
} );

No guest users will be able to comment either, and I guess that is also what you want.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745120733a4612399.html

相关推荐

  • plugins - Comment restrictions Wodpress

    I want to restrict new registered users on my WordPress site from writing comments until 3 days passed their registratio

    7小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信