0

How to hide "comment_form();" for Author role in wordpress? What i need to add in comments.php?

1

You can hook to the comments_open filter.

add_filter('comments_open', function($open, $post_id){
  if(in_array( 'author', (array) wp_get_current_user()->roles){
    return false;
  }
  return $open;
}, 10, 2);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.