The only solution I found was 8 years old
may well still be valid – link to this please
This code will limit the topic title to 80 or whatever number you set $length to
Put it in your child theme functions.php file
add_filter ('bbp_new_topic_pre_title' , 'rew_limit_topic_length' ) ;
add_filter ('bbp_edit_topic_pre_title' , 'rew_limit_topic_length' ) ;
function rew_limit_topic_length ($topic_title) {
$length = 80 ;
if (strlen($topic_title) > $length) {
$topic_title = substr($topic_title, 0, $length);
}
return $topic_title ;
}
Robin;
I have attempted to add the code you provided to my child themes functions.php file and change the length value to 120. It does not reflect that in either the text on the screen or the actual field length itself. Is there something else I can try?
Thank you…
Shawn
hmmm…..
Can you post the copy of the above as you have in your functions file but with any previous function and any subsequent one
Here you go Robin
function oceanwp_child_enqueue_parent_style() {
// Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update your theme)
$theme = wp_get_theme( ‘OceanWP’ );
$version = $theme->get( ‘Version’ );
// Load the stylesheet
wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array( ‘oceanwp-style’ ), $version );
}
add_action( ‘wp_enqueue_scripts’, ‘oceanwp_child_enqueue_parent_style’ );
add_filter (‘bbp_new_topic_pre_title’ , ‘rew_limit_topic_length’ ) ;
add_filter (‘bbp_edit_topic_pre_title’ , ‘rew_limit_topic_length’ ) ;
function rew_limit_topic_length ($topic_title) {
$length = 120 ;
if (strlen($topic_title) > $length) {
$topic_title = substr($topic_title, 0, $length);
}
return $topic_title ;
}
In my plugin bbp-toolkit I have used a filter on bbp_get_title_max_length.
Feel free to install the plugin or look at the code on the use of the filter.