These are exactly the questions I was asking 6 months ago, so I sense your frustration !!
I was expecting to write some stuff on filtering, but having had a quick look at ‘bbp_new_topic_handler’ this doesn’t have any real filtering capability, although it does have some url filters.
Fuller than probably needed answer for the benefit of others !
Ok so you can usually
either filter a function either using bbp_parse_args where you want to change some paramters that are being passed to wp-query
or filter the whole function – if it ends with ‘return apply_filters(..)’ then you can easily copy the whole function and alter it within your child theme, just rename it slightly and then add a filter
so a fictional function called ‘add_name’ in bbpress ends with
Return apply_filters (‘add_name’, $name) ;
you simply copy the whole function and change ‘add_name’ to say ‘my_add_name’ then add a line
add_filter (‘add_name’, ‘my_add_name’)
and wordpress will use your function to replace the original.
But for your function, there is a url filter near the edn but otherwise this is a function that does, so no neat parameters that are replaceable at the end !
I searched bbpress for where this function is used, and in includes/core/actions.php it is added as an action to wherever bbp_post_request is used
Searching for that gets me a bit confused, as I’m not familiar with what this does, and have limited time to chase it down.
Now, having written all that as I was going along, if I were you I’d do one of two things
1. Go further back and find what is calling the function, and then change that. If it is a template, you can alter that in a bbpress folder within your theme to call your function instead, and neither will get overwritten by upgrades.
2. There is no problem in changing core bbpress files as long as a) you are happy you know what you’re doing and b) you make a note of the changed function.
Then on each upgrade, you’ll need to look at whether any code in the function has changed, and if not just overwrite it again. If it has changed, then you’ll need to redo your amendment taking into account the new code. But you sometimes need to do that anyway for a child theme function where bbpress is dealing differently with it.
Yes changing core is ‘frowned’ upon, but only because people do it and then get upset when it is overwritten and they can’t remember what they changed !! Do it with knowledge and you’ll be fine !
After all it just some code that someone’s written, and any ‘rules’ are just made up and have no authority !