wordpress Only allow Admin users to post comments

374 views
asked Jun 1, 2012 in General by Alpha2 (880 points)
hi all

I have a wordpress blog and I want to allow only Administrator users, to post comments into my blog. I want the subscribers to be able to read the comments but not to be able to make any responses.
I tried a few role management plugins such as ‘Role Manager’ and ‘Role Scoper’, but none of what I tried worked like I want it to.
Does anyone know how I can achieve this? Please  help.

Thanks

1 Answer

0 like 0 dislike
answered Jun 1, 2012 by randy999 (4,520 points)
If  the comment form is being called  by your theme in comments.php. Then you can just change the calling function so that only admin users can make comments. You can use the following;
<?php
if(is_user_logged_in() && current_user_can('administrator')) {
  comment_form();
}
?>
...