I'm wondering what's the best way of turning off comments for a Custom Post Type?

I don't want to turn it off completely which is quite easy but to create a checkbox in wp-admin that will turn off comments if checked and show them as usual if not.

Any ideas? :)

  • What have you tried? What are your specific conditions? The obvious answer is the Options API, but where do want the controls (among other details)? – s_ha_dum Feb 16 '14 at 15:54
  • I'd love to use the Settings API, the easiest way that should definitely work is to create some setting and then in single-customposttypename.php do something like if(setting) // do comments. Although I'm wondering if there's any other, more elegant/proper way :) – Wordpressor Feb 16 '14 at 16:02
  • Won't the built in wp option to disable comments on posts and pages be enough? Or, are you trying to enable/disable for all posts at once? – Satish Gandham Feb 16 '14 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.