Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am writing a plugin that upon activation, it creates a few new pages. On these pages, I want to disable the comments option. I am adding the new pages via the code below:

$page['post_type']     = 'page';
$page['post_status']   = 'publish';
$page['post_author']   = 1;
$page['post_parent']   = 0;
$page['post_title']    = 'Test Page';
$page['post_content']  = 'this is a test.  i want to disable the discussion option.';
$pageid = wp_insert_post($page);

In the WordPress codex, I do not see any option/property/meta to disable the Discussion section of a page/post. Does anyone know how?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

As per the documentation:

$page['comment_status'] = 'closed'; // allowed values: 'closed' or 'open'
share|improve this answer
    
wow. Thanks so much for the answer. For some strange reason, I looked right over that attribute. –  ClockwiseQ Apr 5 '13 at 17:06

Your Answer

 
discard

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.