WordPress filter hook

bbp_new_topic_pre_insert

Fired by 5 WordPress plugins, running on 201K+ sites between them.

“No Errors ************************************************************”

How to use bbp_new_topic_pre_insert

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'bbp_new_topic_pre_insert', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Argument names come from bbPress's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

5 plugins that fire bbp_new_topic_pre_insert

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. bbPress icon bbPress100,000+ installs apply_filters( 'bbp_new_topic_pre_insert', array( 'post_author' => $topic_author, 'post_title' => $topic_title, 'post_content' => $topic_content, 'post_status' => $topic_status, 'post_parent' => $forum_id, 'post_type' => bbp_get_topic_post_type(), 'tax_input' => $terms, 'comment_status' => 'closed' ) ) includes/topics/functions.php:359
  2. OttoKit: All-in-One Automation Platform icon OttoKit: All-in-One Automation Platform80,000+ installs apply_filters( 'bbp_new_topic_pre_insert', [ 'post_author' => $user_id, 'post_title' => $topic_title, 'post_content' => $topic_description, 'post_status' => $topic_status, 'post_parent' => $forum_id, 'post_type' => bbp_get_topic_post_type(), 'tax_input' => [], 'comment_status' => 'closed', ] ) src/Integrations/bbpress/actions/addtopicinforum.php:210
  3. Bit integrations icon Bit integrations20,000+ installs apply_filters( 'bbp_new_topic_pre_insert', [ 'post_author' => $user_id, 'post_title' => $data['topic_title'], 'post_content' => $data['topic_content'], 'post_status' => 'publish', 'post_parent' => $forum_id, 'post_type' => bbp_get_topic_post_type(), 'tax_input' => [], 'comment_status' => 'closed', ] ) backend/Actions/BuddyBoss/RecordApiHelper.php:248
  4. Forumax icon Forumax500+ installs apply_filters( 'bbp_new_topic_pre_insert', array( 'post_author' => $topic_author, 'post_title' => $topic_title, 'post_content' => $topic_content, 'post_status' => $topic_status, 'post_parent' => $forum_id, 'post_type' => bbp_get_topic_post_type(), 'tax_input' => $terms, 'comment_status' => 'closed' ) ) lib/bbpress/includes/topics/functions.php:324
  5. FV bbPress Tweaks icon FV bbPress Tweaks10+ installs apply_filters( 'bbp_new_topic_pre_insert', $data ) comment-to-topic.php:136

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.