WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using WordPress comments on a page as a Contact page and I am able to show those comments only to logged in admin.

Now I would like to automatically have any comments placed on my Contact page approved. So, in the front end, I can see all comments placed on that page instead of seeing only the approved comments.

I would love to have a hook in functions.php that works with twenty eleven child theme.

share|improve this question
Why don't you use a contact form plug-in, like Contact Form 7? – Joseph Leedy Nov 17 '12 at 20:34
Well I simply believe that if well use the comments function has everything needed and I just want to have the ability to have the contacts save for later. – exedesign2 Nov 22 '12 at 7:15
up vote 1 down vote accepted

Considering that in Settings > Discussion you have this options checked:

comments moderation and whitelist options

The first is comment_moderation and the second comment_whitelist.

Then, it is possible to selectively disable them using the filter pre_option_(option-name), as follows:

add_filter( 'pre_option_comment_moderation', 'wpse_72990_auto_aprove_selective' );
add_filter( 'pre_option_comment_whitelist', 'wpse_72990_auto_aprove_selective' );

function wpse_72990_auto_aprove_selective( $option ) 
    global $post;
    if( $post->ID == 2 ) 
        return 0;

    return $option;
share|improve this answer
You save my day. – exedesign2 Nov 22 '12 at 7:18
Now my next idea is to separate comments of my contact page from other comments by displaying them through a wordpress theme options or at least putting a filter in comments page. Any suggestion is welcomed. – exedesign2 Nov 22 '12 at 7:21
Answered here: wordpress.stackexchange.com/a/72108/12615 – brasofilo Nov 25 '12 at 15:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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