Skip to content

Shortcodes

BuddyPress Profile Pro registers exactly two shortcodes. Both work in the block editor (add a Shortcode block), the Classic Editor, and any page builder that passes content through do_shortcode().


Renders the extended profile card for a user — the same content that appears on the Extended Fields profile tab.

Registered in: includes/class-buddypress-profile-pro.php
Handler: Buddypress_Profile_Pro_Public::wbbpp_show_profile_shortcode()
Default template: public/buddypress-template/wbbpp-show-profile.php

This shortcode accepts no attributes. The displayed user is resolved automatically:

  • Inside a BuddyPress member profile context (bp_current_component('members') is true): shows the viewed member (bp_displayed_user_id()).
  • On any other page (a standalone “My Profile” page, for example): shows the logged-in user (get_current_user_id()).

Known limitation: Fields within the template are always read with get_current_user_id(), not bp_displayed_user_id(). When the shortcode is placed on a page that is not a BuddyPress profile route, it reliably shows the logged-in user’s data. On a BuddyPress profile route for a different user, the group display is toggled by the viewed user but the field values still come from the logged-in user. Track this as a known issue before relying on it for public member-directory views.

  • Only field groups that have Display at BuddyPress Profile enabled appear.

  • Groups set to bprm_sidebar area render inside .bprm-sidebar-content; groups set to bprm_content render inside .main-wrapper.

  • If no groups have been configured or none have profile display enabled, the shortcode outputs:

    <div class="empty-resume-message">Please build up your resume first.</div>

Copy the default template to your active theme (or child theme) at:

your-theme/buddypress-profile-pro/wbbpp-show-profile.php

The plugin calls locate_template() first; if your override file exists it is loaded instead of the plugin default.

[wbbpp_show_profile]

Add this shortcode to a standalone page — for example, “My Extended Profile” — so members can view their profile data without navigating to the standard BuddyPress member profile tab.


Renders the member profile search form, which lets visitors filter the BuddyPress members list by extended profile field values.

Registered in: includes/class-buddypress-profile-pro.php
Handler: Buddypress_Profile_Pro_Public::wbbpp_show_member_search_form()
Default template: public/buddypress-template/wbbpp-show-member-search-fields.php

This shortcode accepts no attributes. The fields that appear in the form are determined entirely by the search fields configured at WbCom Plugins > BuddyPress Profile Pro > Settings > Profile Search.

If Enable Profile Search is not checked on that settings tab, the shortcode outputs nothing.

When a visitor submits the form:

  1. The submitted field values are stored in the wprm-profile-search cookie (via wbbpp_set_request() on the wp hook).
  2. On the BuddyPress members directory, the bp_ajax_querystring filter (wbbpp_filter_members_querystring, priority 99) reads the cookie and restricts the members loop to the matching user IDs.
  3. Clicking the form’s Clear button (or submitting wbbpp_form=clear) deletes the cookie and resets the list.

The search result is stored in a first-party cookie, so it persists across page navigation within the same session.

The plugin also injects this same form automatically above the BuddyPress members directory via the bp_before_directory_members_tabs action. Use the shortcode when you want the form elsewhere — a sidebar widget area, a dedicated “Find Members” page, or a custom template.

If you place the shortcode on the members directory page itself, remove the automatic injection to avoid a duplicate form:

add_action( 'init', function() {
$public = new Buddypress_Profile_Pro_Public(
'buddypress-profile-pro',
WBBPP_PLUGIN_VERSION
);
remove_action(
'bp_before_directory_members_tabs',
[ $public, 'wbbpp_add_member_search_form' ]
);
} );
[wbbpp_member_form]

Place this shortcode in a sidebar or on a dedicated search page so visitors can look up members before opening the full /members/ directory.