WordPress.org

Ready to get started?Download WordPress

Forums

Disable the comment field? possible?? (7 posts)

  1. phattrance
    Member
    Posted 5 years ago #

    how do i disable all comments on the blog? i have disabled it from the settings --> discussions --> Allow people to post comments on the article but the comment field is still there on the blog. i tried to clear all the cache but nothing helps!

    heres an test url: http://dailymobile.se/2009/01/22/nokia-e75-qwerty-high-quality-pictures/

  2. MichaelH
    Member
    Posted 5 years ago #

    From my notes, these SQL statements. Backup your database first!!!

    UPDATE wp_posts SET comment_status='closed' WHERE post_status = 'publish' AND post_type = 'post';
    UPDATE wp_posts SET comment_status='open' WHERE post_status = 'publish' AND post_type = 'post';
    UPDATE wp_posts SET comment_status='closed' WHERE post_status = 'publish' AND post_type = 'page';
    ;
    `

  3. subvertednation
    Member
    Posted 5 years ago #

    I ran this code in phpMyAdmin and it knocked my whole site offline. How can I undo what this has done? I got this information from HERE, and now all I get is a database error when I try to load the site. This is the error: Error establishing a database connection

    This is the code: UPDATE wp_posts SET comment_status="closed";

    Now my entire site is down. How can I fix this?

  4. subvertednation
    Member
    Posted 5 years ago #

    Nevermind, I fixed the DB issue, but I would still like to UNDO what this query did. Can someone help please?

  5. sweetangst
    Member
    Posted 5 years ago #

    Some people don't read.

    Backup your database first!!!

    The link you posted previously looks like it's working just fine. If you're having problems writing new posts, check that your wp-config.php settings are correct.

    And honestly, MichaelH, you're making this entirely too complicated.

    If you don't want anyone to be able to comment on anything anywhere, just edit your theme's index.php & other template pages and remove the code that inserts the comment form/link to begin with.

    Stuff like this (your own page code may differ):

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

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    If you don't want anyone to be able to comment on anything anywhere, just edit your theme's index.php & other template pages and remove the code that inserts the comment form/link to begin with.

    Won't work. You'll still get comment spam coming in that way, since spam bots don't use your forms.

    To disable comments, you have to actually disable comments.

    The correct SQL to use:
    UPDATE wp_posts SET comment_status = 'closed', ping_status = 'closed' WHERE comment_status = 'open';

  7. sweetangst
    Member
    Posted 5 years ago #

    While you are correct about the spam & that step would also be necessary, the question wasn't about comment spam.

    The question was how to remove the comment field from the page.

Topic Closed

This topic has been closed to new replies.

About this Topic