Skip to:
Content
Pages
Categories
Search
Top
Bottom
Codex HomeEmails → Filter Emails

Filter Emails

You can filter the email fields by using the bp_email_set_tokens filter hook found in /bp-core/classes/class-bp-email.php.

For example, this will limit the BuddyPress message content to 50 words.
Change 50 to whatever integer you want.

function bp_email_content_length( $formatted_tokens, $tokens, $obj ) {
	
  $formatted_tokens['usermessage'] = wp_trim_words( $formatted_tokens['usermessage'], 50, '...' );
	
  return $formatted_tokens;
	
}
add_filter( 'bp_email_set_tokens', 'bp_email_content_length', 10, 3 );
Skip to toolbar