WordPress action hook

bbp_new_topic

Fired by 7 WordPress plugins, running on 209K+ sites between them.

“Update counts, etc... ********************************************”

How to use bbp_new_topic

It's an action: your callback runs at that point and receives 4 arguments. Nothing needs to be returned. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_action( 'bbp_new_topic', function( $topic_id, $forum_id, $anonymous_data, $topic_data ) {
	// Your code runs here.
}, 10, 4 );

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

7 plugins that fire bbp_new_topic

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

  1. bbPress icon bbPress100,000+ installs do_action( 'bbp_new_topic', $topic_id, $forum_id, $anonymous_data, $topic_data['post_author'] ) includes/topics/functions.php:414
  2. OttoKit: All-in-One Automation Platform icon OttoKit: All-in-One Automation Platform80,000+ installs do_action( 'bbp_new_topic', $topic_id, $forum_id, $anonymous_data, $user_id ) src/Integrations/bbpress/actions/addtopicinforum.php:259
  3. Bit integrations icon Bit integrations20,000+ installs do_action( 'bbp_new_topic', $topic_id, $forum_id, null, $user_id ) backend/Actions/BuddyBoss/RecordApiHelper.php:285
  4. bbp style pack icon bbp style pack6,000+ installs do_action( 'bbp_new_topic', $post->ID, $forum_id, 0, $post->post_author ) modtools/moderation.php:239
  5. bbPress Notify (No-Spam) icon bbPress Notify (No-Spam)2,000+ installs do_action( 'bbp_new_topic', $topic_id, $forum_id, $anonymous_data, $topic_author ) includes/controller/class-bbpress-notify-nospam-controller-ajax.php:97
  6. Forumax icon Forumax500+ installs do_action( 'bbp_new_topic', $topic_id, $forum_id, $anonymous_data, $topic_data['post_author'] ) lib/bbpress/includes/topics/functions.php:376
  7. FV bbPress Tweaks icon FV bbPress Tweaks10+ installs do_action( 'bbp_new_topic', $forum_post_id, $forum_id, $this->comment_author, $author ) comment-to-topic.php:158

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.