WordPress.org

Ready to get started?Download WordPress

Forums

Global comment disable -- how to test for it? (2 posts)

  1. jaredh123
    Member
    Posted 5 years ago #

    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.

  2. jaredh123
    Member
    Posted 5 years ago #

    figured it out myself:

    if ( 'open' == get_option( 'default_comment_status' ) )

    values are "open" or "closed"

Topic Closed

This topic has been closed to new replies.

About this Topic