anyone know how can i open comments on a specific post in WordPress? I tried comments_open($id);
but it doesn’t work.
<?php
comments_open( get_the_ID() );
?>
Thanks a lot.
EDIT:
i tried by specifieng it in functions.php, nothing changed.
add_filter( 'comments_open', 'feedbackOpen', 10, 2 );
function feedbackOpen( $open, $post_id ) {
$post = get_post( $post_id );
if($post->post_type == 'product'){
if (get_post_meta($post->ID, 'Allow Comments', true)) {$open = true;}
}else{
return false;
}
return $open;
}
The
<?php comments_open( $post_id ); ?>
don’t open comment on a specified post ID but either return true or false depending if comments are allowed or not for this postThere is how to open comment
https://core.trac.wordpress.org/browser/tags/4.0/src/wp-includes/post.php
There is how to display the comment form for the current post
http://codex.wordpress.org/Function_Reference/comment_form
Go to the administration. Find the particular post, and open it to go to its Edit page. Then, from the top right portion of the screen, click “Screen Options”. From there, toggle “Discussion”. This will make the “Discussion” meta box appear below your post’s WYSIWYG editor. There you can tick “Allow Comments”, and “Allow trackbacks and pingbacks on this page.”
If you want to do this programatically, you can use the following code: