bbp_code_trick( string $content = '' )

Filter the topic or reply content and output code and pre tags

Description

Parameters

$content

(string) (Optional) Topic and reply content

Default value: ''

Return

(string) Partially encodedd content

Source

File: bp-forums/common/formatting.php

function bbp_code_trick( $content = '' ) {
	$content = str_replace( array( "\r\n", "\r" ), "\n", $content );
	$content = preg_replace_callback( "|(`)(.*?)`|",      'bbp_encode_callback', $content );
	$content = preg_replace_callback( "!(^|\n)`(.*?)`!s", 'bbp_encode_callback', $content );

	return $content;
}

Changelog

Changelog
Version Description
bbPress (r4641) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.