Welcome to the new design! Please report any bugs or issues, thanks :)
Web Dev + WordPress + Security

WordPress Plugin: Override Comment Options

[ Override Comment Options ] Want to keep comments open on a few old posts? This plugin is for you. It does one thing and does it well: it overrides the WordPress setting, “Automatically close comments on articles older than x days”. So you can leave comments open for any individual posts that may have passed the deadline. I actually wrote this plugin for use here at Perishable Press. Normally comments are closed after 90 days, but there are a few old posts for which I would like to keep comments open. This plugin makes it super easy to do.

Override WordPress “automatically close comments” option and leave comments open on any individual posts.

How it works

In the WordPress Discussion Settings, there is an option called “Automatically close comments on posts older than” whatever specified number of days. When this setting is enabled, comments will be disabled on any posts that are past the deadline, whatever “x” number of days.

What WordPress is missing is a simple way to override that global option on a per-post basis. That’s exactly what this plugin does. For any post that is past the comment deadline, this plugin will display a small meta box on the “Edit Post” screen for each post. There you can check the box to enable comments on the post. Comments will then remain open for that post indefinitely, until the box is unchecked or the plugin is uninstalled.

Installation & Usage

First install and activate the plugin:

  1. Upload the plugin to your blog and activate
  2. Make sure the WordPress General > Discussion setting “Automatically close comments” is enabled
  3. Done!

This plugin does not provide any options page. Instead, it displays a small Meta Box in the sidebar on the “Edit Post” screen. There you can check the box to enable comments on the post. Comments will then remain open for that post indefinitely, until the box is unchecked or the plugin is uninstalled.

Check out the screenshot below to get a better idea.

[ Screenshot of plugin meta box ]OCO meta box displayed on the Edit Post screen (click to view full-size in new tab)
Note: The override meta box will not be displayed if the post is not past the comment deadline (whatever “x” number of days).
Note: Uninstalling the plugin from the WordPress Plugins screen results in the removal of all plugin data from the WordPress database. This includes all override meta data for your posts.

Features

I try to keep all of my WordPress plugins as lightweight and fast as possible. The Override Comment Options consists of only about 80 lines of code and has a very small footprint. Other features include:

  • Clean, secure code
  • Written according to the WP API
  • Simple, lightweight, and flexible
  • Localized and translation ready
  • Cleans up after itself when uninstalled

For more details about how it works, visit the Installation docs at WordPress.org.

Download

Override Comment Options is open source and 100% free for everyone. Learn more and download at the WP Plugin Directory.

Jeff Starr
About the Author
Jeff Starr = Creative thinker. Passionate about free and open Web.
BBQ Pro: The fastest firewall to protect your WordPress.

One response to “WordPress Plugin: Override Comment Options”

  1. Excellent and useful plugin
    thanks

Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
Banhammer: Protect your WordPress site against threats.
Thoughts
Playing the long game.
They have weaponized the idiots.
Good software never steals focus from the user. Even during startup.
After 10 years running my own business, I still manage schedules and tasks using old school post-it notes, sometimes simple sometimes very elaborate.
You know those sites, where you're trying to just grab a quick bit of information but the page is shifting all over the place as it loads up 3 million advertisements.
Selling two of my top WordPress domains, wp-zen.com & zen-wp.com $300 for both. Aged 9 years. Drop a line if interested.
Never force your users to type out a password (or any long string of characters) by blocking the paste function. Typing long strings leads to MORE errors than simple copy/paste.