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.

I'm using wordpress for my company website but I want to remove the comments function completely so not just by unchecking a "alow comments" within every page.

I did some googeling and the said I was supposed to remove this line of code:

<?php comments_template(); // Get wp-comments.php template ?>

And this code should be located in page.php but I'm unable to find this code. Maybe this was a way to do it in a old version of wordpress?

Does anyknow know how I can remove it? :)

share|improve this question
    
What theme are you using? Do you want to disable commenting across the whole site? –  fightstarr20 Apr 16 '13 at 18:11
    
In twentytwelve, comments_template can be found in page.php, single.php, image.php and page-templates/full-width.php. Your theme should have some similar organization - at least as regards single.php. –  vancoder Apr 16 '13 at 21:00
    
Just use Disable Comments: wordpress.org/extend/plugins/disable-comments –  Andrew Bartel Apr 16 '13 at 23:32
add comment

2 Answers

Will unchecking these options not satisfy your needs (especially the last one)?

  • Attempt to notify any blogs linked to from the article
  • Allow link notifications from other blogs (pingbacks and trackbacks)
  • Allow people to post comments on new articles

All can be found at the top of the Discussion Settings page.

share|improve this answer
add comment

One thing you can do is remove all mentions of comments from the admin area.

So to remove the comments metaboxes from the admin pages for posts and pages, as well as from the dashboard, use this in your functions.php:

add_action('admin_menu', 'remove_shit');

function remove_shit() {
    //Dashboard
    remove_meta_box('dashboard_recent_comments','dashboard','core'); // recent comments box

    //Meta boxes on post page
    remove_meta_box('commentsdiv', 'post', 'normal');
    remove_meta_box('commentstatusdiv','post','normal'); // comments metabox

    //Meta boxes on page page (haha)
    remove_meta_box('commentstatusdiv','page','normal'); // discussion metabox
    remove_meta_box('commentsdiv','page','normal'); // comments metabox
}

In addition to this, you can remove the "Discussion" area from the settings:

add_action( 'admin_menu', 'remove_menu_items' );

function remove_menu_items() {
     remove_menu_page('edit-comments.php'); //comments
     remove_submenu_page( 'options-general.php', 'options-discussion.php' ); // discussion under settings
}

Then, to remove the "Comments" column from the admin area for posts and pages, use:

function remove_columns( $columns ) {
  unset($columns['comments']);
  return $columns;
}
    //Posts
     add_action( 'admin_init' , 'filter_post_columns' );

    function filter_post_columns() {
      add_filter( 'manage_posts_columns' , 'remove_columns' );
    }

    //Pages
     add_action( 'admin_init' , 'filter_pages_columns' );

    function filter_pages_columns() {
      add_filter( 'manage_pages_columns' , 'remove_columns' );
    }

The advantage of this method is that you don't have to modify the WordPress core, so it'll stay even if you update WordPress.

share|improve this answer
1  
I think ps_remove_columns should just be remove_columns. –  vancoder Apr 16 '13 at 23:17
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.