I have a wordpress site with bunch of users, each of them having their own page with comments. I would like to implement a checkbox for users on the front end, to turn(toggle) on and off the comments. I know I can do it myself from the back end individually for each user page, but I need to let them to get their option.

In another words....is that possible to make a clone of that checkbox(from the admin panel) with the same functionality on the front end(on the user page)?

Can I have any idea on how to implement this?

I will appreciate any help for this. Thanks

1 Answer 1


you should do something like this

//For update a page when use costum template
$post = get_the_ID();

 $my_post = array(
  'ID'           => $post,
  'comment_status' => 'open' // closed

// Update the post into the database
wp_update_post( $my_post );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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