When loading replies from bbPress, a filter is applied to the_title that prepends the string “Reply To:” to the beginning of the reply’s topic title. Below is code that removes the filter, and adds a new one without the offending string.

<?php
/*
 * Filter for bbpress reply post_title, without "Reply To: " prefix
 * - reference: https://bbpress.trac.wordpress.org/browser/trunk/src/includes/replies/template.php
 */
function custom_bbp_get_reply_title_fallback( $post_title = '', $post_id = 0 ){
  // Bail if title not empty, or post is not a reply
  if ( ! empty( $post_title ) || ! bbp_is_reply( $post_id ) ) {
    return $post_title;
  }
  
  // Get reply topic title.
  $topic_title = bbp_get_reply_topic_title( $post_id );
  // Get empty reply title fallback.
  $reply_title = sprintf( __( '%s', 'bbpress' ), $topic_title );  
  
  return apply_filters( 'bbp_get_reply_title_fallback', $reply_title, $post_id, $topic_title );  
}
// add custom filter
add_filter( 'the_title', 'custom_bbp_get_reply_title_fallback', 2, 2);
// remove bbpress default filter
remove_filter( 'the_title', 'bbp_get_reply_title_fallback', 2);

About the Author

Jonathan Daggerhart

Long time Drupal and WordPress developer. I like to write modules and plugins, and I dabble in frontend and design.

4 thoughts on “Remove “Reply To:” from bbPress Reply Titles

Leave a Reply

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