How to disable FAQ comments

To disable comments in general, go to your wp-admin panel. Then open Settings > Discussions. There you can disable “allow people to submit comments on new posts”.

If you only want to disable comments for certain FAQs, then open a post and see discussions box. There you can uncheck “Allow Comments”.

disable wp comments for single post
disable wp comments for single post

You can also disable comments for all frequently asked question post types. Simply put the following code into your functions.php file.

function disable_comments_for_faq_post_types( $open, $post_id ) {
    $post_type = get_post_type( $post_id );
    // disable comments for built-in "faq" post type
    if ( $post_type == 'faq' ) {
        return false;
    }
    // enable comments for any other post types
    return true;
}
add_filter( 'comments_open', 'disable_comments_for_faq_post_types', 10 , 2 );

Deja una respuesta

Tu dirección de correo electrónico no será publicada.