• Resolved mtwist

    (@mtwist)


    I am running Automattic’s Untitled theme on trainerkatie.com.

    Since it is a business page, I want to disable the ability to comment on all pages except the Blog. I’ve adjusted the Screen Settings at the top right and fiddled in the Discussions settings, but to no avail.

    Currently it is set so that comments must be approved, so none will be, but it just isn’t professional to have a comments option on most of the pages. How do I get rid of it?

    CSS code?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi mtwist;

    First disable comment support on pages by adding a few line of code in your theme’s functions.php file.

    add_action( 'init', 'mxcpr_hide_comment_pages' );
    function mxcpr_hide_comment_pages() {
    	remove_post_type_support( 'page', 'comments' );
    }

    The above code will disable comments on page post type. But if you already published pages, it will keep comments on them.

    So then we can add css to hide them on your theme.

    .page #comments.comments-area {
    display: none !important;
    }
    Thread Starter mtwist

    (@mtwist)

    Thanks for the prompt response. I’m new to WordPress. How do I go about adding to the php file?

    You should be able to turn comments off on each page/post – click on Show Discussion on that options. OR click on Quick edit for each post/page and unclick comments for that specific page.

    If that does not work, try just adding the CSS code above to JetPack’s custom CSS module – once activated, it will show up as Edit CSS.

    If you are going to modify any theme files (i.e. the functions.php file above) you would need to make and put those changes in a child theme –

    https://codex.wordpress.org/Child_Themes

    Otherwise all of your changes will be lost when the theme is updated.

    Thread Starter mtwist

    (@mtwist)

    Thank you WPyogi! That did the trick and was so simple.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘How to disable all comments?’ is closed to new replies.