# bbPress: Minimum Length for Topics and Replies

> Refuses very short forum posts such as "thanks" or "+1" by requiring a minimum number of characters in topics and replies.

- Type: PHP
- Runs: Run everywhere
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: bbpress, moderation, quality
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/bbpress-minimum-post-length/

## Code

```php
if ( ! function_exists( 'bbp_add_error' ) ) {
    return;
}

$wpide_bbp_min_topic = 40;
$wpide_bbp_min_reply = 10;

add_filter( 'bbp_new_topic_pre_content', function ( $content ) use ( $wpide_bbp_min_topic ) {
    if ( mb_strlen( trim( wp_strip_all_tags( (string) $content ) ) ) < $wpide_bbp_min_topic ) {
        bbp_add_error( 'wpide_bbp_short', sprintf( '<strong>Error:</strong> Please describe your topic in at least %d characters.', $wpide_bbp_min_topic ) );
    }

    return $content;
} );

add_filter( 'bbp_new_reply_pre_content', function ( $content ) use ( $wpide_bbp_min_reply ) {
    if ( mb_strlen( trim( wp_strip_all_tags( (string) $content ) ) ) < $wpide_bbp_min_reply ) {
        bbp_add_error( 'wpide_bbp_short', sprintf( '<strong>Error:</strong> Replies need at least %d characters.', $wpide_bbp_min_reply ) );
    }

    return $content;
} );
```

## Notes

Set separate limits for topics and replies at the top.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "bbPress: Minimum Length for Topics and Replies" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
