bbp_force_comment_status( bool $open = false, int $post_id )
Force comments_status to ‘closed’ for bbPress post types
Description Description
Parameters Parameters
- $open
-
(Optional) True if open, false if closed
Default value: false
- $post_id
-
(Required) ID of the post to check
Return Return
(bool) True if open, false if closed
Source Source
File: includes/core/theme-compat.php
function bbp_force_comment_status( $open = false, $post_id = 0 ) { // Default return value is what is passed in $open $retval = (bool) $open; // Get the post type of the post ID $post_type = get_post_type( $post_id ); // Only force for bbPress post types if ( in_array( $post_type, bbp_get_post_types(), true ) ) { $retval = false; } // Filter & return return (bool) apply_filters( 'bbp_force_comment_status', $retval, $open, $post_id, $post_type ); }
Changelog Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |