Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to use the user-interface (front-end) part of Wordpress to open comments on all posts in one (or two) clicks? I have many posts with closed comments which must have happened by mistake, and I want to make them all open comments.

Here's the caveat: My host provider doesn't give me ssh access into the database, so I can't just run a simple sql REPLACE command. Therefore, I need a way to do this from the Administration Panel within wordpress.

Thanks!

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

I wrote up this quick plugin that updates all posts of type post to comment_status open on activation, it should work for you. you can immediately deactivate and delete it once you activate it that once.

<?php
/*
Plugin Name: update comment status
*/
function activate_update_comment_status() {
    global $wpdb;
    $wpdb->update( 
        $wpdb->posts, 
        array( 
            'comment_status' => 'open'
        ), 
        array(
            'post_type' => 'post'
        ), 
        array( 
            '%s'
        ), 
        array(
            '%s'
        ) 
    );
}
register_activation_hook( __FILE__, 'activate_update_comment_status' );
share|improve this answer
    
Thanks a lot! This is exactly what I needed –  Amit Jul 13 '12 at 20:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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