wp_filter[ $tag ][ $priority ]; // Unset the filters unset( $bbp->filters->wp_filter[ $tag ][ $priority ] ); // Priority is empty } else { // Store filters in a backup $wp_filter[ $tag ] = $bbp->filters->wp_filter[ $tag ]; // Unset the filters unset( $bbp->filters->wp_filter[ $tag ] ); } } // Check merged filters if ( isset( $bbp->filters->merged_filters[ $tag ] ) ) { // Store filters in a backup $merged_filters[ $tag ] = $bbp->filters->merged_filters[ $tag ]; // Unset the filters unset( $bbp->filters->merged_filters[ $tag ] ); } return true; } /** * Force comments_status to 'closed' for bbPress post types * * @since 2.1.0 bbPress (r3589) * * @param bool $open True if open, false if closed * @param int $post_id ID of the post to check * @return bool True if open, false if closed */ 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 ); } /** * Remove "prev" and "next" relational links from on bbPress pages. * * WordPress automatically generates these relational links to the current * page, but bbPress does not use these links, nor would they work the same. * * In this function, we remove these links when on a bbPress page. This also * prevents additional, unnecessary queries from running. * * @since 2.6.0 bbPress (r7071) */ function bbp_remove_adjacent_posts() { // Bail if not a bbPress page if ( ! is_bbpress() ) { return; } // Remove the WordPress core action for adjacent posts remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10 ); }