I love when things go wrong! It gives me an opportunity to, perhaps, enlighten people with solutions that may find themselves in a familiar situation. Recently, I have been toying with some comments systems on the site, namely Intense Debate and DISQUS. In the process of experimenting with both of these services I noticed that there had been no comments since disabling them. Upon further investigation I had realized that after disabling Intense Debate all comments and trackbacks / pingbacks had been disabled.
There are a few ways you can go about re-enabling comments and trackbacks / pingbacks:
- Edit every single post to allow them
- Perform a Bulk Action page by page of posts
- Perform a PHP query via phpMyAdmin – easy enough, if you have access to phpMyAdmin
- You can run an SQL query using the WP-DBManager plugin if you don’t have access to phpMyAdmin
- Add some code to your functions.php file
phpMyAdmin / WP-DBManager Plugin
This is originally how I fixed my problem. Since then, I have decided to implement the functions.php method on many of the sites I work with now.
Query to turn on Comments
UPDATE wp_posts SET comment_status = 'open';
Query to turn off Comments
UPDATE wp_posts SET comment_status = 'closed';
Query to turn on Pingbacks
UPDATE wp_posts SET ping_status = 'open';
Query to turn off Pingbacks
UPDATE wp_posts SET ping_status = 'closed';
functions.php
To open all comments / trackbacks and pingbacks on posts and KEEP them open.
// ---------------------------------------------------------------------- // Start Comment / trackbacks and pingbacks status update // ---------------------------------------------------------------------- global $wpdb; $pingfuturestatus = array('ping_status' => 'open'); $pingcurrentstatus = array('ping_status' => 'closed'); $commentfuturestatus = array('comment_status' => 'open'); $commentcurrentstatus = array('comment_status' => 'closed'); $wpdb->update($wpdb->posts, $pingfuturestatus, $pingcurrentstatus); $wpdb->update($wpdb->posts, $commentfuturestatus, $commentcurrentstatus); // ---------------------------------------------------------------------- // End Comment / trackbacks and pingbacks status update // ----------------------------------------------------------------------
Note: These functions are not of my own creation, simply things I have found along the way. If you are the author of this function, please let me know so I can properly credit you with your work!
Your thoughts?