QuestionsCategory: General QuestionsHow to Remove “Leave a Reply” in WordPress Site?
Jackies
asked 5 months ago
At the bottom of each static WordPress page is a section on “Leave a Reply”, but I would like to remove this section in several pages on my sites. I can’t find a way to turn if off. How do I do that?
1 Answers
tech Staff
answered 5 months ago
To remove the "Leave a Reply" section from specific pages in WordPress, you have a few options:
  1. Disable Comments Globally: If you don't want comments on any page or post, you can disable them globally. Go to your WordPress dashboard, navigate to Settings > Discussion, and uncheck the option that says "Allow people to post comments on new articles". However, this will disable comments for all pages and posts site-wide.
  2. Disable Comments on Individual Pages: For specific pages, you can disable comments individually. When editing a page, scroll down to the "Discussion" section in the editor and uncheck the box that says "Allow comments". This option might not be visible by default, so you may need to enable it from the "Screen Options" tab at the top right corner of the editor screen.
  3. Use a Plugin: If you need more control or want to remove the "Leave a Reply" section from multiple pages at once, you can use a plugin like "Disable Comments". This plugin allows you to globally disable comments, but also provides options to disable comments on specific post types or individual posts/pages.
  4. Custom Code: If you're comfortable with code, you can add custom code to your theme's functions.php file to programmatically disable comments on specific pages. Here's an example of how you can achieve this:
 
function disable_comments_on_specific_pages( $open, $post_id ) {
        // Specify the IDs of the pages where you want to disable comments
        $pages_to_disable_comments = array( 10, 20, 30 ); // Replace these IDs with your actual page IDs

        // Check if the current page is in the list of pages to disable comments
        if ( in_array( $post_id, $pages_to_disable_comments ) ) {
               return false; // Disable comments
        }
    return $open;
}
add_filter( 'comments_open', 'disable_comments_on_specific_pages', 10, 2 );
  Replace the $pages_to_disable_comments array with the IDs of the pages where you want to disable comments. Choose the method that best fits your needs and level of comfort with WordPress. If you need further assistance or have any questions, feel free to ask!

Please login or Register to submit your answer