WordPress filter hook

bp_core_get_table_prefix

Fired by 6 WordPress plugins, running on 202K+ sites between them.

“Filters the $wpdb base prefix.”

How to use bp_core_get_table_prefix

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( 'bp_core_get_table_prefix', function( $base_prefix ) {
	// Change $base_prefix here.
	return $base_prefix;
}, 10, 1 );

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

6 plugins that fire bp_core_get_table_prefix

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( 'bp_core_get_table_prefix', $bbp_db->base_prefix ) includes/admin/tools/upgrade.php:296
  2. BuddyPress icon BuddyPress90,000+ installs apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix ) bp-core/bp-core-functions.php:188
  3. Better Messages icon Better Messages10,000+ installs apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix ) bp-better-messages.php:1467
  4. BuddyPress Follow icon BuddyPress Follow1,000+ installs apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix ) loader.php:59
  5. Forumax icon Forumax500+ installs apply_filters( 'bp_core_get_table_prefix', $bbp_db->base_prefix ) lib/bbpress/includes/admin/tools/upgrade.php:273
  6. BuddyPress FollowMe icon BuddyPress FollowMe10+ installs apply_filters( 'bp_core_get_table_prefix', $wpdb->base_prefix ) loader.php:65

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.