WordPress Code Snippets

A fresh mix of code snippets and tutorials

Filter pre tags in bbPress


A couple of functions used at htaccessbook.com to enable unescaped/unencoded pre and code tags in bbPress forum posts.

To use this snippet, first remove both underscores _ from the pre tags. Specifically, find these in the code:

_pre and _/pre

..and change them to these:

pre and /pre

(This step is needed in order to display the code on the page here at WP-Mix.)

Once the two underscores have been changed, add the code to your theme’s functions.php and done. Once in place, this function will ensure that pre and code tags are not removed/encoded/escaped by bbPress.

If you are not concerned about code tags, here is a simpler function that will ensure that pre tags are allowed in forum posts:

No editing is required for either of the functions presented in this tutorial to work. Just plug ’n play, and be sure to test the results.

Learn more

WordPress Themes In Depth

Show Support

Like our new Facebook Page to show support!