Creating Custom Taxonomies and Displaying on About Us Page

Get Started

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

Custom Taxonomy Multiselect Update Guide in BuddyPress Business Profile (1.9.1)

What’s New

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

For Users with Custom Code Snippets

If you’ve previously added custom code to display taxonomies (following the documentation approach), you have two options:

Option 1: Remove Your Custom Code (Recommended)

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.

Option 2: Keep Your Custom Code

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' );

What Changed

1. Business Creation Form

  • Custom taxonomies now support multiple selection
  • Uses proper array syntax for form submission

2. Business Settings Page

  • Already supported multiselect
  • No changes needed

3. About Page Display

  • Automatically shows all custom taxonomies
  • Displays term names instead of IDs
  • Works for both hierarchical and non-hierarchical taxonomies

Troubleshooting

Seeing Duplicate 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

Taxonomies Not Showing?

  1. Ensure taxonomies are registered with 'public' => true
  2. Check that terms are assigned to the business
  3. Verify no conflicting filters are applied

Want Different Display Format?

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

Hooks Available:

  • bp_business_profile_enable_builtin_taxonomy_display – Filter to enable/disable built-in display
  • bp_business_profile_after_render_contact_info – Action where taxonomies are displayed
  • bp_business_profile_after_category_section – Alternative location for taxonomy display

Support

If you experience any issues after this update:

  1. First try removing any custom taxonomy display code
  2. Clear your site’s cache
  3. Check the browser console for JavaScript errors
  4. Contact support if issues persist
Last updated: September 26, 2025