How to filter bbpress content in WordPress

Posted on In Tutorial

In WordPress, we can filter the post content by adding a filter to the_content:

add_filter('the_content', 'inline_markdown_pre_process_shortcode2', 7);

But how to filter the content for bbpress contents?

bbpress topic and reply (they are separated) content have their own filters:

bbp_get_topic_content and bbp_get_reply_content.

For example,

add_filter('bbp_get_topic_content', 'my_plugin_custom_bbp_function');
add_filter('bbp_get_reply_content', 'my_plugin_custom_bbp_function');
function my_plugin_custom_bbp_function($content) {
  return 'my_plugin_custom_bbp_function processed: '.$content;
}

Leave a Reply

Your email address will not be published. Required fields are marked *