WordPress.org

Support

Support » Themes and Templates » Global comment disable — how to test for it?

Global comment disable — how to test for it?

  • I’m working on my theme, and my question is, if someone UN-checks
    “Allow people to post comments on the article” under “Settings” > “Discussion”, how do I test for that in the template files?

    I’d like for my main loop to test for that setting and not include the comments template at all if it is unchecked.

    I know how to use (‘open’ == $post->comment_status ) but that only checks for comments disabled on a per-post basis, not for this global setting.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • figured it out myself:

    if ( ‘open’ == get_option( ‘default_comment_status’ ) )

    values are “open” or “closed”

Viewing 1 replies (of 1 total)
  • The topic ‘Global comment disable — how to test for it?’ is closed to new replies.