Disable Comments For Link And Quote Post Formats

How to Disable Comments For Link And Quote Post Formats

in Comments
Google+ LinkedIn

WordPress introduced Post Formats with version 3.1. A Post Format is a piece of meta information that can be used by a theme to customize its presentation of a post. By default WordPress comes with number of standard post formats but themes are not required to support every format on the list. Support for a particular post format can be enabled or disabled from theme itself. These post formats support all post features including post comments which in my opinion, is not necessary for some of the formats. For example links or quote.

Most bloggers use link post format to feature external articles without needing to write any content. Therefore in most cases it’s completely unnecessary to accept comments on such articles. You can always disable comment on an individual post from post setting but disabling comments on all posts in one shot is much easier. That’s why in this article I will show you how to disable comments for post formats.

To disable comments on post formats, simply paste this code in your theme’s functions.php file. In this particular example I am disabling comments on link and quote post formats but you can extend to other formats which you do not require to have comments.

// disable comments for link and quote post formats
function wcs_disable_comments_post_formats( $open ) {
    if ( 'link' == get_post_format() || 'quote' == get_post_format() ) {
        $open = false;
    return $open;
add_filter( 'comments_open', 'wcs_disable_comments_post_formats', 10, 2 );

Share the love

If you like this snippet, share it with others!

2 Replies on "Disable Comments For Link And Quote Post Formats"

  1. anon

    Works like a charm and no extra plugin needed! Thank you…

    1. Anon,

      I am glad you found it helpful.
      Thank you for stopping by. :)

Leave a Reply

Your email address will not be published. Required fields are marked *