Step 1: Create Custom Taxonomies for Business Types and Locations
To create custom taxonomies for Business Types and Business Locations and link them to the business post type, add the following code to your theme’s functions.php file or in a custom plugin:
add_action( 'init', function() {
// Register Business Location Taxonomy
register_taxonomy( 'business-location', array( 'business' ), array(
'labels' => array(
'name' => 'Business Locations',
'singular_name' => 'Business Location',
'menu_name' => 'Business Location',
'all_items' => 'All Business Locations',
'edit_item' => 'Edit Business Location',
'view_item' => 'View Business Location',
'update_item' => 'Update Business Location',
'add_new_item' => 'Add New Business Location',
'new_item_name' => 'New Business Location Name',
'parent_item' => 'Parent Business Location',
'search_items' => 'Search Business Locations',
'not_found' => 'No Business Locations found',
'no_terms' => 'No Business Locations',
'items_list' => 'Business Location list',
),
'public' => true,
'hierarchical' => true,
'show_in_menu' => true,
'show_in_rest' => true,
) );
// Register Business Type Taxonomy
register_taxonomy( 'business-type', array( 'business' ), array(
'labels' => array(
'name' => 'Business Types',
'singular_name' => 'Business Type',
'menu_name' => 'Business Type',
'all_items' => 'All Business Types',
'edit_item' => 'Edit Business Type',
'view_item' => 'View Business Type',
'update_item' => 'Update Business Type',
'add_new_item' => 'Add New Business Type',
'new_item_name' => 'New Business Type Name',
'parent_item' => 'Parent Business Type',
'search_items' => 'Search Business Types',
'not_found' => 'No Business Types found',
'no_terms' => 'No Business Types',
'items_list' => 'Business Type list',
),
'public' => true,
'hierarchical' => true,
'show_in_menu' => true,
'show_in_rest' => true,
) );
} );
Step 2: Link Taxonomies to the Business Post Type
After the above code is added, the Business Locations and Business Types taxonomies will be linked to the business custom post type, and they will be available to assign to business posts in the WordPress admin area.
Step 3: Display Business Types and Locations on the About Us Page
To display the Business Types and Business Locations on the “About Us” page template, you can use the get_the_terms() function to retrieve the taxonomy terms and display them dynamically.
Add this snippet to your about-us.php template (or wherever the About Us content is being displayed):
add_action( 'bp_business_profile_after_render_contact_info', 'display_business_taxonomies' );
function display_business_taxonomies() {
global $post;
// Get terms for Business Locations
$business_locations = get_the_terms( $post->ID, 'business-location' );
if ( ! empty( $business_locations ) && ! is_wp_error( $business_locations ) ) {
echo '<div class="bp-business-info-widget-section">';
echo '<h3 class="bp-business-screen-title">' . esc_html__( 'Business Location', 'bp-business-profile' ) . '</h3>';
foreach ( $business_locations as $location ) {
echo '<p><i class="fas fa-map-marker-alt"></i> ' . esc_html( $location->name ) . '</p>';
}
echo '</div>';
}
// Get terms for Business Types
$business_types = get_the_terms( $post->ID, 'business-type' );
if ( ! empty( $business_types ) && ! is_wp_error( $business_types ) ) {
echo '<div class="bp-business-info-widget-section">';
echo '<h3 class="bp-business-screen-title">' . esc_html__( 'Business Type', 'bp-business-profile' ) . '</h3>';
foreach ( $business_types as $type ) {
echo '<p><i class="fas fa-briefcase"></i> ' . esc_html( $type->name ) . '</p>';
}
echo '</div>';
}
}
Step 4: Adjust Hook Location (Optional)
If you want to display these taxonomies in a different location on the About Us page, you can use the bp_business_profile_after_render_contact_info hook instead. Simply change the hook in the code as follows:
add_action( 'bp_business_profile_before_render_contact_info', 'display_business_taxonomies' );
This will display the taxonomies after the contact information section.
With the BuddyPress Business Profile 1.9.1 following changes have been added
The BP Business Profile plugin now includes built-in support for:
- Multiselect custom taxonomies
- Proper display of taxonomy names (instead of IDs)
- Automatic display on About pages
If you’ve previously added custom code to display taxonomies (following the documentation approach), you have two options:
Remove any custom code you added for displaying taxonomies, such as:
// REMOVE THIS CODE if you have it
function display_business_taxonomies() {
global $post;
$business_locations = get_the_terms( $post->ID, 'business-location' );
$business_types = get_the_terms( $post->ID, 'business-type' );
// ... display code
}
add_action( 'bp_business_profile_after_render_contact_info', 'display_business_taxonomies' );
The plugin now handles this automatically.
If you prefer to keep your custom implementation, disable the built-in display:
// Add this to your theme's functions.php or custom plugin
add_filter( 'bp_business_profile_enable_builtin_taxonomy_display', '__return_false' );
- Custom taxonomies now support multiple selection
- Uses proper array syntax for form submission
- Already supported multiselect
- No changes needed
- Automatically shows all custom taxonomies
- Displays term names instead of IDs
- Works for both hierarchical and non-hierarchical taxonomies
You likely have custom code that needs to be removed. Check:
- Your theme’s
functions.php - Any code snippets plugins
- Custom plugins you’ve created
- Ensure taxonomies are registered with
'public' => true - Check that terms are assigned to the business
- Verify no conflicting filters are applied
Use the filter to disable built-in display and implement your own:
// Disable built-in display
add_filter( 'bp_business_profile_enable_builtin_taxonomy_display', '__return_false' );
// Add your custom display
add_action( 'bp_business_profile_after_render_contact_info', 'my_custom_taxonomy_display' );
function my_custom_taxonomy_display( $business_id ) {
// Your custom implementation
}
Technical Details
bp_business_profile_enable_builtin_taxonomy_display– Filter to enable/disable built-in displaybp_business_profile_after_render_contact_info– Action where taxonomies are displayedbp_business_profile_after_category_section– Alternative location for taxonomy display
If you experience any issues after this update:
- First try removing any custom taxonomy display code
- Clear your site’s cache
- Check the browser console for JavaScript errors
- Contact support if issues persist
