Participate in our upcoming live webinar to learn how you can manage your commissions with the Stripe Split Payment on 31st July at 10 pm IST. Register Now
How can we help?

Hide Comment on Single Event Listing Page

A user of WP Event Manager can display or hide the comment section on the single event listing page. In this guide, you will learn about how you can disable or hide the comment section on your single event listing page.

Here are the steps you need to take to perform the task:

  1. Open your child theme,
  2. Add the following code into the funtions.php file.
    function wpem_comment_disable( $open, $post_id ) 
    {
        $post_type = get_post_type( $post_id );
    
        if ( $post_type == 'event_listing' ) {
            return false;
        }
    
        return true;
    }
    add_filter( 'comments_open', 'wpem_comment_disable', 10 , 2 );
    
  3. Find a single.php file in the parent theme directory & duplicate it in the child theme.

    Find comments_template() function in single.php.

    There should be the following code:

    if (comments_open() || get_comments_number()) :
         if ('event_listing' !== get_post_type()) :
             comments_template();
         endif;
    endif;
    
  4. Save.
Hide Comment On Single Event Listing Page
Editorial Team

Our team constantly explores ways that technology can help us reinvent industries. We want to change the world by creating great products that transform industries. We Dream It, We Make It.

Quick Links
Close
Close