bbp_force_comment_status( bool $open, int $post_id )
Force comments_status to ‘closed’ for Forums post types
Description
Parameters
- $open
-
(bool) (Required) True if open, false if closed
- $post_id
-
(int) (Required) ID of the post to check
Return
(bool) True if open, false if closed
Source
File: bp-forums/core/theme-compat.php
function bbp_force_comment_status( $open, $post_id = 0 ) { // Get the post type of the post ID $post_type = get_post_type( $post_id ); // Default return value is what is passed in $open $retval = $open; // Only force for Forums post types switch ( $post_type ) { case bbp_get_forum_post_type() : case bbp_get_topic_post_type() : case bbp_get_reply_post_type() : $retval = false; break; } // Allow override of the override return apply_filters( 'bbp_force_comment_status', $retval, $open, $post_id, $post_type ); }
Changelog
Version | Description |
---|---|
bbPress (r3589) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.