Skip to content

Hooks & Filters Reference

BuddyX Theme overviewFree + ProGet BuddyX Theme →

Reference of the significant action hooks and filters the BuddyX Pro theme fires. Every hook listed here is fired (do_action) or applied (apply_filters) in the shipped 5.1.4 code. Plugin hooks the theme only listens to (core WordPress, BuddyPress, WooCommerce, LearnDash, etc.) are out of scope - see those projects’ own references.

BuddyX Pro fires a large surface (roughly 55 own actions and 70 own filters). This page documents the ones you are most likely to hook. Grep the code for do_action( 'buddyx / apply_filters( 'buddyx to see the complete set.


Fired from header.php and footer.php.

Hook Fires
buddyx_head_top Immediately inside <head>
buddyx_head_bottom End of <head>, before </head>
buddyx_body_top Right after <body> opens (also fires buddyx_wp_body_open)
buddyx_page_top Top of #page wrapper
buddyx_page_bottom Bottom of #page, before wp_footer()
buddyx_body_bottom After wp_footer(), before </body>
add_action( 'buddyx_head_bottom', 'my_head_meta' );
function my_head_meta() {
echo '<meta name="theme-color" content="#c92a2b">';
}

Fired from header.php and the header template parts.

Hook Fires
buddyx_header_before Before the <header id="masthead"> element
buddyx_header_wrapper_before Inside the header, before the inner wrapper
buddyx_header_wrapper_after Inside the header, after the inner wrapper
buddyx_header_after After the </header> element
buddyx_header_actions Inside the desktop menu-icons area (search / cart / color-mode toggle)
buddyx_mobile_menu_actions Inside the mobile navigation actions (template-parts/header/navigation.php)

There is no buddyx_header hook - that name is not fired anywhere in the theme. Use buddyx_header_actions to add header widgets. The Color_Mode_Toggle component hooks its toggle onto buddyx_header_actions at priority 50.

// Add a header widget next to the search / cart icons.
add_action( 'buddyx_header_actions', 'my_header_widget', 20 );
function my_header_widget() {
echo '<div class="my-header-widget">Hi</div>';
}

The most widely used pair - fired around the main content area from every top-level template (index.php, single.php, page.php, archive.php, buddypress.php, bbpress.php, the FluentCart/LearnDash templates, etc.).

Hook Fires
buddyx_before_content Before the content container opens
buddyx_after_content After the content container closes
add_action( 'buddyx_before_content', 'my_content_notice' );
function my_content_notice() {
echo '<div class="my-notice">Custom content here</div>';
}
Hook Fires
buddyx_sub_header Page-title / sub-header area, after the site header

Default callback: buddyx_sub_header().

// Replace the default page header.
remove_action( 'buddyx_sub_header', 'buddyx_sub_header' );
add_action( 'buddyx_sub_header', 'my_page_header' );
function my_page_header() {
echo '<div class="my-page-header">Custom Header</div>';
}

Fired from the template-parts/content/ and template-parts/layout/ parts.

Hook Fires
buddyx_entry_before Before an entry <article>
buddyx_entry_after After an entry <article>
buddyx_entry_content_before Before the entry content
buddyx_entry_content_after After the entry content
buddyx_entry_meta_after After the entry meta row
buddyx_before_archive_loop Before the archive loop starts
add_action( 'buddyx_entry_content_after', 'my_after_post' );
function my_after_post() {
if ( is_singular( 'post' ) ) {
echo '<div class="author-bio">...</div>';
}
}
Hook Fires
buddyx_before_breadcrumb Before the breadcrumb trail
buddyx_after_breadcrumb After the breadcrumb trail

Fired from sidebar.php / sidebar-buddypress.php.

Hook Fires
buddyx_sidebar_before Before the sidebar widget area
buddyx_sidebar_after After the sidebar widget area

Fired from footer.php and template-parts/footer/info.php.

Hook Fires
buddyx_footer_before Before the <footer> element
buddyx_footer_after After the <footer> element
buddyx_copyright_before Before the copyright row
buddyx_copyright_after After the copyright row
add_action( 'buddyx_footer_before', 'my_prefooter' );
function my_prefooter() {
echo '<div class="pre-footer">Newsletter signup</div>';
}

Fired from template-parts/header/buddyx-panel.php.

Hook Fires
buddyx_before_inner_panel Before the inner side-panel content
buddyx_after_inner_panel After the inner side-panel content

Fired from the login/register form parts.

Hook Fires
buddyx_login_form_top / buddyx_login_form_bottom Top / bottom of the login form
buddyx_register_form_top / buddyx_register_form_bottom Top / bottom of the registration form
buddyxpro_recaptcha_after_login_form After the login form (reCAPTCHA seam)
buddyxpro_recaptcha_after_register_form After the register form (reCAPTCHA seam)
Hook Fires Parameters
buddyx_pro_post_comment_before Before the post comments section -
buddyx_pro_before_comment_replay Before the comment reply link $comment_id, $comment
buddyx_pro_after_comment_replay After the comment reply link $comment_id, $comment
add_action( 'buddyx_pro_after_comment_replay', 'my_comment_actions', 10, 2 );
function my_comment_actions( $comment_id, $comment ) {
echo '<button class="report-comment">Report</button>';
}
Hook Fires
buddyx_before_member_avatar_member_directory Before a member avatar in the members directory
buddyx_before_group_avatar_group_directory Before a group avatar in the groups directory
buddyx_before_item_meta / buddyx_after_item_meta Around directory item meta
buddyx_buddypress_member_send_message_button_call Around the member “send message” button

Fired from the Dokan store container (inc/compatibility/dokan/dokan-functions.php).

Hook Fires
buddyx_store_container_open Inside the store-page container open
buddyx_store_container_close Inside the store-page container close

Fired from the FluentCart single-product template (all default priority 10).

Hook Fires
buddyx_fluentcart_before_product_content / buddyx_fluentcart_after_product_content Start / end of the product template
buddyx_fluentcart_before_product_header / buddyx_fluentcart_after_product_header Around product title and meta
buddyx_fluentcart_before_product_description / buddyx_fluentcart_after_product_description Around the product description
buddyx_fluentcart_product_tabs Product tabs area
buddyx_fluentcart_before_related_products / buddyx_fluentcart_after_related_products Around related products
add_action( 'buddyx_fluentcart_after_product_header', 'my_trust_badges' );
function my_trust_badges() {
echo '<div class="trust-badges">Secure checkout</div>';
}

Asset Manifest Filters (primary extension seams)

Section titled “Asset Manifest Filters (primary extension seams)”

These are the recommended entry points for adding, removing, or reconfiguring theme assets. See the Theme Architecture asset section.

File: inc/Styles/Component.php

Filters the CSS manifest ($handle => $data map) that drives every conditional stylesheet enqueue. Add an entry to register a new integration stylesheet, or unset one to drop it.

add_filter( 'buddyxpro_css_files', function ( $css_files ) {
$css_files['my-integration'] = array(
'file' => 'my-integration.css',
'global' => false,
'preload_callback' => function () {
return class_exists( 'My_Plugin' );
},
'media' => 'all',
'deps' => array(),
'loading' => null,
);
return $css_files;
} );

File: inc/Scripts/Component.php

Filters the JavaScript manifest that drives every conditional script enqueue (same shape, with footer / localize keys).

add_filter( 'buddyxpro_js_files', function ( $js_files ) {
unset( $js_files['buddyxpro-entry-share-popup'] ); // drop share popup
return $js_files;
} );

File: inc/Styles/Component.php

Whether the theme preloads its non-global stylesheets. When true, action_preload_styles() prints a <link rel="preload" ... onload="this.rel='stylesheet'"> tag in wp_head for every registered stylesheet whose preload_callback returns true, and template parts print the real link tag in-body through buddyxpro()->print_styles(). Return false and those stylesheets are enqueued directly on wp_enqueue_scripts instead, while print_styles() becomes a no-op.

Default: ! buddyxpro()->is_amp() - true on a normal request, false on an AMP request.

Each of these integration stylesheets has a helper in inc/Helpers/Conditional_Assets.php that sniffs the request and decides whether the CSS is needed. The filter sits at the end of the helper, so it runs only after every built-in sniff has already failed. Use it to force the CSS onto pages the sniff cannot see: custom templates, PHP-only shortcode calls, page builders.

Filter Stylesheets it can force Default
buddyxpro_needs_event_calendar_assets buddyx-eventscalendar false
buddyxpro_needs_learndash_assets buddyx-learndash, the buddyx-dark-mode focus-mode overrides, and buddyx-ld-dashboard (that one also needs the Ld_Dashboard class) false
buddyxpro_needs_bbpress_assets buddyx-bbpress false
buddyxpro_needs_dokan_assets buddyx-dokan false

Returning false cannot switch a stylesheet off, because a sniff that already matched returns before the filter runs. Three of the four also return early when the plugin class is missing, so returning true does nothing without The Events Calendar, LearnDash or Dokan active. buddyxpro_needs_bbpress_assets has no such early return, so it is reachable even when bbPress is not installed.

// Load the LearnDash CSS on a custom template the sniff cannot detect.
add_filter( 'buddyxpro_needs_learndash_assets', function ( $needs_assets ) {
return is_page_template( 'my-course-hub.php' ) ? true : $needs_assets;
} );

File: inc/Post_Thumbnails/Component.php

The theme registers five custom image sizes on after_setup_theme. Each size takes three filters: width, height, and the crop argument passed to add_image_size(). These are developer-only. The sizes are registered in code and are not offered in the media UI.

Size Width filter Height filter Crop filter Defaults Used for
buddyxpro-featured buddyxpro_featured_width buddyxpro_featured_height buddyxpro_featured_crop 900, 515, true Magazine-layout feature cards, 1-column grid and masonry cards, and the default archive thumbnail
buddyxpro-large buddyxpro_large_width buddyxpro_large_height buddyxpro_large_crop 1024, 508, false The featured image on singular posts
buddyxpro-list buddyxpro_list_width buddyxpro_list_height buddyxpro_list_crop 300, 250, true Archive thumbnails when the blog layout is list layout
buddyxpro-col-two buddyxpro_col_two_width buddyxpro_col_two_height buddyxpro_col_two_crop 450, 300, true Grid and masonry archive thumbnails at exactly 2 columns
buddyxpro-col-three buddyxpro_col_three_width buddyxpro_col_three_height buddyxpro_col_three_crop 350, 250, true Grid and masonry archive thumbnails at 3 or more columns, and the editorial layout

buddyxpro-large is the only theme size that is not hard-cropped by default. The layout that picks between list, grid and masonry is the blog_layout_option setting under Appearance > Customize.

Add your callbacks from a child theme functions.php or a must-use plugin so they are in place before after_setup_theme fires, then regenerate thumbnails so existing uploads get the new dimensions.

add_filter( 'buddyxpro_featured_width', function () {
return 1200;
} );
Filter File Purpose
buddyxpro_customizer_settings inc/Customizer_Settings/ Filters the full customizer settings definition
buddyx_customizer_field_type_map inc/Customizer_Framework/ Maps field type to control class
buddyx_customizer_field_args inc/Customizer_Framework/ Filters per-field args before registration
buddyxpro_color_scheme_presets inc/Customizer_Settings/ Color-scheme preset list
buddyxpro_typography_presets - Typography preset list
buddyxpro_header_presets - Header layout presets
buddyxpro_google_fonts inc/Fonts/ Available Google font list
Filter Purpose
buddyx_breadcrumb_trail_args Default breadcrumb args
buddyx_breadcrumb_trail_items Final breadcrumb items array
buddyx_breadcrumb_trail_labels Breadcrumb label strings
buddyx_breadcrumb_trail_object Short-circuit with a custom trail object
buddyx_breadcrumb_trail Final rendered breadcrumb HTML
Filter Returns
buddyx_search_slide_toggle_data_attrs Data-attribute string for the search toggle button
buddyx_search_field_toggle_data_attrs Data-attribute string for the search field container
add_filter( 'buddyx_search_slide_toggle_data_attrs', function () {
return 'data-animation="slide" data-speed="300"';
} );
Filter Purpose
buddyxpro_minimal_layout_force_no_sidebar Force no sidebar in the minimal layout
buddyxpro_display_title_and_description Toggle archive title + description output
buddyxpro_filter_archive_posts_per_page Archive posts-per-page override
buddyxpro_post_categories_limit Max categories shown per entry
buddyxpro_reading_time_minutes Filter the computed reading time
buddyxpro_page_settings_post_types Post types that get the per-page settings meta box
buddyx_enable_post_thumbnails Toggle post-thumbnail support
buddyx_off_canvas_filter_button_output Off-canvas filter button markup
Filter Purpose
buddyxpro_login_presets Login-page brand presets
buddyxpro_register_page_login_url Register-page login URL
buddyx_lostpassword_url Lost-password URL
buddyxpro_login_frontend_dep_handle Registered style handle the register-page inline login CSS attaches to. Default: buddyxpro-global, the theme’s main handle. Point it at your own handle if your child theme swaps the main stylesheet
Filter Purpose
buddyxpro_install_catalog The recommended-plugins catalog shown by the Plugin Installer / Welcome screen

File: inc/Helpers/Dark_Mode.php (since 5.1.5)

Whether a stored per-visitor color-mode preference (user meta, cookie, localStorage) is ignored and the owner’s site_color_mode default is used instead. It is read by buddyx_color_mode_force_default(), which both the server-side resolver and the client-side FOUC bootstrap call, so the two sides always resolve to the same mode.

Default: ! buddyxpro_color_mode_toggle_enabled() - true when the visitor toggle is hidden, false when it is shown. buddyxpro_color_mode_toggle_enabled() reads get_theme_mod( 'site_color_mode_toggle_show', 'on' ), so on a default site the toggle is shown and the filtered default is false.

The two settings it derives from are at Appearance > Customize > Site Skin: “Color mode” (site_color_mode, default light) and “Show color-mode toggle” (site_color_mode_toggle_show, default on).

// Hide the toggle, but still honor a mode the visitor picked earlier.
add_filter( 'buddyxpro_force_default_color_mode', '__return_false' );

File: inc/compatibility/buddynext/buddynext-functions.php (since 5.1.6)

Whether the BuddyX Side Panel is hidden while a BuddyNext hub route renders. When it returns true, buddyx_pro_buddynext_hide_side_panel_locations() (hooked to has_nav_menu) reports the buddyx-panel and buddyx-panel-logged-out menu locations as unassigned, so template-parts/header/buddyx-panel.php skips rendering. That happens on BuddyNext routes only and has no effect anywhere else.

Default: true

Note the prefix on this one: buddyx_pro_, not buddyxpro_.

The filter is reachable only when the compatibility file loads. functions.php requires it when BUDDYNEXT_VERSION is defined and BuddyPress is inactive, and the callback additionally requires \BuddyNext\Core\PageRouter::is_bn_route(). The menu locations it suppresses are “Side Menu - Logged in users” and “Side Menu - Logged out users” under Appearance > Menus > Manage Locations.

// Keep the Side Panel visible on BuddyNext pages.
add_filter( 'buddyx_pro_buddynext_hide_side_panel', '__return_false' );
Filter Purpose
buddyx_bp_is_current_action Whether the current BP action matches (used across BP templates)
buddyx_buddypress_member_send_message_button_url Member “send message” button URL
buddyx_get_member_joined_date Member joined-date string
buddyx_learndash_lms_get_course_participants_per_page Participants per page
buddyx_ld_modify_course_features Course features list
buddyx_ld_filter_course_author_url Course author URL

On the search results page BuddyX Pro keeps the normal WordPress results and adds one short panel per active Wbcom plugin below them: BuddyNext (buddynext), Jetonomy (jetonomy), Eventonomy (eventonomy), WPMediaVerse (mediaverse) and Learnomy (learnomy). Each panel shows the first few matches and a See all link to that plugin’s own search. Panels run as the current visitor, so each plugin’s own privacy rules apply, and results are cached for 5 minutes per search term and visitor. If no supported plugin is active, or nothing matches, the search page is unchanged.

Hook Type Arguments What it does
buddyx_pro_search_after_results action none Fires after the normal results loop in index.php and optional/search.php. The panels render here.
buddyx_pro_search_federation filter bool $enabled (default true) Return false to switch the panels off.
buddyx_pro_search_federation_providers filter array $providers The provider list keyed by id. Each entry has label, priority and a callback.
buddyx_pro_search_federation_excluded_providers filter string[] $excluded (default empty) Provider ids to drop. Applied last, so an exclusion always wins.
buddyx_pro_search_federation_buddynext_direct_link_types filter array $types BuddyNext result types whose own link is trusted. Default user, member, space, post, media.
buddyx_pro_search_federation_buddynext_cpt_types filter array $types BuddyNext result types stored as WordPress posts. Default job, listing, company, resume, employer, candidate.
buddyx_pro_search_federation_buddynext_row_url filter string $url, string $type, array $item The final link for one BuddyNext result row. Return an empty string to leave the row as plain text.
buddyx_use_buddynext_header_search filter bool $use (default true) With BuddyNext active the header search icon opens BuddyNext’s community search. Return false to keep the WordPress search overlay.
// Keep one plugin's results off the search page.
add_filter( 'buddyx_pro_search_federation_excluded_providers', function ( $ids ) {
$ids[] = 'eventonomy';
return $ids;
} );

Theme components add their hooks inside initialize():

namespace BuddyxPro\BuddyxPro\MyComponent;
use BuddyxPro\BuddyxPro\Component_Interface;
class Component implements Component_Interface {
public function get_slug(): string {
return 'my_component';
}
public function initialize() {
add_action( 'wp_head', array( $this, 'add_meta_tags' ) );
add_filter( 'body_class', array( $this, 'add_body_classes' ) );
}
public function add_body_classes( $classes ) {
$classes[] = 'my-custom-class';
return $classes;
}
}

  • Use the correct priority (lower = earlier); the color-mode toggle occupies priority 50 on buddyx_header_actions.
  • Check context (is_singular(), is_page(), is_buddypress()) before outputting.
  • Escape all output (esc_html(), esc_attr(), esc_url()).
  • Return a value from filter callbacks - never echo.
  • Prefer the buddyxpro_css_files / buddyxpro_js_files manifest filters over dequeueing by handle where possible.
  • Prefix your callbacks so they never collide with the theme’s buddyx_* / buddyxpro_* functions.