bbp_register_template_stack( $location_callback = '', int $priority = 10 )

This is really cool. This function registers a new template stack location, using WordPress’s built in filters API.


This allows for templates to live in places beyond just the parent/child relationship, to allow for custom template locations. Used in conjunction with bbp_locate_template(), this allows for easy template overrides.



(string) (Required) Callback function that returns the


(int) (Optional)

Default value: 10


File: bp-forums/core/template-functions.php

function bbp_register_template_stack( $location_callback = '', $priority = 10 ) {

	// Bail if no location, or function does not exist
	if ( empty( $location_callback ) || ! function_exists( $location_callback ) )
		return false;

	// Add location callback to template stack
	return add_filter( 'bbp_template_stack', $location_callback, (int) $priority );


Version Description
bbPress (r4323) Introduced.


We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.