Wordpress - Set post comments open function
Have you tried go to Posts and checked the box next to the title and in the dropdown "Bulk Actions" choose Edit and then apply, Comments and in the dropdown "Allow".
And also have added the screen in the post edit area on the tab in the header called "Screen Options" and checked the field called: Discussion?
And in Settings->Discussion have you enabled "Allow people to post comments on new articles"?
Add comments open to all posts
A filter hook called by the wp_insert_post
function prior to inserting into or updating the database and update the post comment_status
to open = true
function comments_on( $data ) {
if( $data['post_type'] == 'post' ) {
$data['comment_status'] = 1;
}
return $data;
}
add_filter( 'wp_insert_post_data', 'comments_on' );