One Click Close Comments

Author:Scott Reilly
First released:2009-06-12
Last update:2015-09-15
Compatibility:WP 2.8 – 4.3.1
Download:[ zip ]

Conveniently close or open comments for a post or page with one click.

Extended Description

From the admin listing of posts (‘Edit Posts’) and pages (‘Edit Pages’), a user can close or open comments to any posts to which they have sufficient privileges to make such changes (essentially admins and post authors for their own posts). This is done via an AJAX-powered color-coded indicator. The color-coding gives instant feedback on the current status of the post for comments: green means the post/page is open to comments, red means the post/page is closed to comments. Being AJAX-powered means that the change is submitted in the background without requiring a page reload.

This plugin will only function for administrative users in the admin who have JavaScript enabled.

Links: Plugin Homepage | Plugin Directory Page | Author Homepage

Find out more at the plugin’s WordPress Plugin Repository page.


Click to see full-size image.

  1. one-click-close-comments screenshot 1

    A screenshot of the ‘Posts’ admin page with the plugin activated. The tooltip reads: «Comments are open. Click to close.» Were the mouse to hover over the red indicator, the tooltip would read: «Comments are closed. Click to open.»


  1. Unzip inside the /wp-content/plugins/ directory for your site (or install via the built-in WordPress plugin installer)
  2. Activate the plugin through the ‘Plugins’ admin menu in WordPress
  3. When on the ‘Edit Posts’ or ‘Edit Pages’ admin pages, click the indicators to toggle the comment status for a post, as necessary.


The plugin exposes one action for hooking.

c2c_one_click_close_comments_click_char (action)

The ‘c2c_one_click_close_comments_click_char’ hook allows you to use an alternative character or string as the plugin’s indicator in the posts listing tables. It is the character that get color-coded to indicate if comments are open or close, and the thing to click to toggle the comment open status. By default this is a bullet, • (a solid circle).


  • $char (array): The character to be used for display (by default this is •).


 * Changes the character used as the one-click link to a diamond.
 * @param string $char The default character (a bullet)
 * @return string
function custom_one_click_char( $char ) {
    return '♦';
add_filter( 'c2c_one_click_close_comments_click_char', 'custom_one_click_char' );

Frequently Asked Questions

Q. I can see the colored dots indicating current commenting status, but why aren’t they clickable?
A. The commenting status link/button is only clickable is you have JavaScript enabled.

Q. What does the color-coding of the dot mean?
A. Green means the post is currently open for comments; red means the post is not currently open for comments.

Q. How can I customize the color-coding used for the dot?
A. You can customize the colors via CSS. .comment-state-1 indicates comments are open. .comment-state-0 indicates comments are closed.

Q. How can I customize the dot used to represent commenting status?
A. By default, commenting status is represented using the • character. You can change this by filtering c2c_one_click_close_comments_click_char. Here’s an example — added to a theme’s functions.php file — to change it to a solid diamond:

add_filter( 'c2c_one_click_close_comments_click_char', create_function('$a', 'return "&diams";') );

Release Log

2.3.4 (2015-09-15)

  • Bugfix: Really revert back to using dirname(__FILE__); DIR is only PHP 5.3+
  • Change: Note compatibility through WP 4.3+.

2.3.3 (2015-03-12)

  • Revert back to using dirname(__FILE__); DIR is only PHP 5.3+

2.3.2 (2015-02-18)

  • Reformat plugin header
  • Use DIR instead of dirname(__FILE__)
  • Minor code reformatting (spacing, bracing)
  • Minor documentation spacing changes throughout
  • Change documentation links to to be https
  • Note compatibility through WP 4.1+
  • Update copyright date (2015)
  • Add plugin icon
  • Rengenerate .pot


  • Minor code tweaks (spacing)
  • Note compatibility through WP 3.8+
  • Update copyright date (2014)
  • Change donate link
  • Update banner image to reflect WP 3.8 admin refresh
  • Update screenshot to reflect WP 3.8 admin refresh


  • Use string instead of variable to specify translation textdomain
  • Remove load_config() and merge its contents into do_init()
  • Add check to prevent execution of code if file is directly accessed
  • Note compatibility through WP 3.5+
  • Update copyright date (2013)
  • Move screenshot into repo’s assets directory


  • Re-license as GPLv2 or later (from X11)
  • Add ‘License’ and ‘License URI’ header tags to readme.txt and plugin file
  • Add banner image for plugin page
  • Remove ending PHP close tag
  • Note compatibility through WP 3.4+


  • Increase font size for click character to make it a larger click target
  • Fix for one-click character not being clickable for quick-edited post rows
  • Enqueue CSS and JavaScript rather than defining in, and outputting via, PHP
  • Create ‘assets’ subdirectory and add admin.js and admin.css to it
  • Add enqueue_scripts_and_styles(), register_styles(), enqueue_admin_css(), enqueue_admin_js()
  • Remove add_css(), add_js()
  • Hook ‘load-edit.php’ action to initialize plugin rather than using pagenow
  • Add version() to return plugin version
  • Create ‘lang’ subdirectory and move .pot file into it
  • Regenerate .pot
  • Note compatibility through WP 3.3+
  • Add ‘Domain Path’ directive to top of main plugin file
  • Add link to plugin directory page to readme.txt
  • Update screenshot for WP 3.3
  • Update copyright date (2012)


  • Note compatibility through WP 3.2+
  • Minor code formatting changes (spacing)
  • Fix plugin homepage and author links in description in readme.txt


  • Switch from object instantiation to direct class function invocation
  • Rename the class from ‘OneClickCloseComments’ to ‘c2c_OneClickCloseComments’
  • Declare all class methods public static and class variables private static
  • Output JS via ‘admin_print_footer_scripts’ action instead of ‘admin_footer’ action
  • Rename filter from ‘one-click-close-comments-click-char’ to ‘c2c_one_click_close_comments_click_char’
  • Add Filters section to readme.txt
  • Note compatibility through WP 3.1+
  • Update copyright date (2011)


  • Don’t even define class unless in the admin section of site
  • Store plugin instance in global variable, $c2c_one_click_close_comments, to allow for external manipulation
  • Move registering actions and filters into init()
  • Remove docs from top of plugin file (all that and more are in readme.txt)
  • Note compatibility with WP 3.0+
  • Minor tweaks to code formatting (spacing)
  • Add Upgrade Notice section to readme.txt
  • Remove trailing whitespace


  • Display commenting status even if JS is disabled
  • Render commenting status as a ‘span’ instead of an ‘a’ and use unobtrusive JS to make it clickable
  • Insert column into desired position using PHP instead of JS
  • Fix issue related to disappearance of button for a post after using Quick Edit
  • Fix issue of ‘Allow Comments’ checkbox in ‘Quick Edit’ getting out of sync with actual comment status
  • Allow filtering of character used as click link, via ‘one-click-close-comments-click-char’
  • Move initialization of config array out of constructor and into new function load_config()
  • Create init() to handle calling load_textdomain() and load_config() (textdomain must be loaded before initializing config)
  • Add support for localization
  • Add PHPDoc documentation
  • Add .pot file
  • Note compatibility with WP 2.9+
  • Drop compatibility with versions of WP older than 2.8
  • Update documentation (descriptions, FAQs, etc) to reflect behavior changes
  • Update copyright date


  • Bail out early if not on pertinent admin pages
  • Make use of admin_url() for path to admin section
  • Note WP 2.8 compatibility


  • Initial release

Copyright & Disclaimer

Copyright © 2009-2015 by Scott Reilly (aka coffee2code)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Discussion / Support

Have any questions, comments, or suggestions? Please provide them via the plugin’s support forum. I’ll do my best to reply in a timely fashion and help as best I can.

Unfortunately, I cannot provide guaranteed support, nor do I provide support via any other means.

Was this plugin useful useful to you? Consider giving it a rating. If you’re inclined to give it a poor rating, please first post to the support forum to give me a chance to address or explain the situation.