WordPress.org

Ready to get started?Download WordPress

Forums

How do we remove comments (9 posts)

  1. thierrymartin
    Member
    Posted 9 years ago #

    Is there a safe and elegant way to remove all trackback and comments links and references - when I try to remove specific lines it causes parsing errors.

  2. tcloer
    Member
    Posted 9 years ago #

    You can swith off comments and trackbacks under Options >> Discussion. This only affects new posts, though.

  3. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Which version of wp ?

  4. thierrymartin
    Member
    Posted 9 years ago #

    1.5 beta - I want to remove even the references like "no comments" at or "comments closed" from the bottom of pages.

  5. To stop comments and trackbacks, delete the wp-comments-post.php and wp-trackback.php files. To delete the references to them on the main pages, look for the values like "no comments" or "comments closed" in index.php and delete them.

  6. hooopla
    Member
    Posted 9 years ago #

    To stop comments and trackbacks, delete the wp-comments-post.php and wp-trackback.php files. To delete the references to them on the main pages, look for the values like "no comments" or "comments closed" in index.php and delete them.

    Is this still considered the best approach for 1.5 final?

  7. jefwhite
    Member
    Posted 9 years ago #

    I'm not at 1.5 yet, but I found that if I set "use_trackback" and "use_pingback" values in the "options" table to "0", those options disappear in the "writing" pane.

  8. jaymoon
    Member
    Posted 9 years ago #

    After hours of searching, and help from my buddy, we discovered that there's a line of code in the index.php file located in the dir of the theme you are currently using.

    I'm assuming you mean the part where it says "Posted in (category) | Edit | Comments disabled"

  9. emt036
    Member
    Posted 9 years ago #

    (Assuming you are working with the default theme:)

    Delete wp-comments-post.php and wp-trackback.php in your root directory, and then delete comments.php and comments-popup.php in your theme directory.

    Then, in the index.php in your theme directory delete:

    <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>

    In the single.php of your theme directory, delete:

    <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { // Both Comments and Pings are open ?>
    You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(display); ?>">trackback</a> from your own site.

    <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    // Only Pings are Open ?>
    Responses are currently closed, but you can <a href="<?php trackback_url(display); ?> ">trackback</a> from your own site.

    <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    // Comments are open, Pings are not ?>
    You can skip to the end and leave a response. Pinging is currently not allowed.

    <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    // Neither Comments, nor Pings are open ?>
    Both comments and pings are currently closed.

    Also delete:
    <?php comments_template(); ?>

    That should be it.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.