612-293-8629 HELLO@THEMIGHTYMO.COM

Today, I had the challenge of allowing users to use the target=”_blank” html attribute in BuddyPress forum topic replies. By default, BuddyPress will ignore any target attributes you add to your links.

The secret fix is to tell BuddyPress that you want to allow the target attribute by adding the following code to your functions.php file:

/* Add the HTML <a> tag attribute 'target' to the list
 * of allowed tags & attributes in BP's activity filters.
 */
function ufmn_add_target_attribute( $activity_allowedtags ) {
	$activity_allowedtags['a']['target']    = array();
	return $activity_allowedtags;
}
add_filter( 'bp_activity_allowed_tags', 'ufmn_add_target_attribute', 1 );
add_filter( 'bp_forums_allowed_tags', 'ufmn_add_target_attribute', 1 );

Pretty neat, eh?!

CREDIT: Literally ALL of the credit for the above solution goes to Dave Ellenwood over at DPE Design.

PHONE, EMAIL, TEXT

We love to communicate: phone, email, text, Facebook, Twitter, LinkedIn, you name it.

LOCATIONS

PAYMENTS ACCEPTED

LINKS