0

I want to hide comments for a certain time and show a sample text in the comment text area. Say, there are 50 comments on a post. What I want is- hide every comments on this post and there will be a text saying "this comment is hidden". Is it possible?

I am very new with WordPress.

3

Yes, possible.

Add this to your theme's functions.php file-

add_filter( 'get_comment_text', 'replace_comment_texts' );

function replace_comment_texts() {
    return "This comment is hidden";
}

I have written a plugin few days back, that does the exact thing. You can try this too- https://wordpress.org/plugins/mask-comments/

3
  • but what if I change the theme? should I replace replace this functions.php file?
    – pranesh
    Feb 20 '16 at 9:59
  • 1
    Anyway, that plugin works.
    – pranesh
    Feb 20 '16 at 10:01
  • 1
    @pranesh, create an mu-plugins folder in wp-content, create in that folder a *.php file and add there your code which you want to be used for whatever theme. OR create your own plugin with that kind of code snippets.
    – Charles
    Feb 20 '16 at 16:56

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.