Post Terms Separator in Bricks

When post_terms_<taxonomy> dynamic data tag is used in Bricks in an element like the “Meta Data”, the linked terms are separated by commas by default.

Note: The Separator control you see in the above screenshot is not for the individual terms, but rather the items of that element.

If you would like these to be replaced with another like | or spaces or remove them completely, we can use the bricks/dynamic_data/post_terms_separator filter like this:

add_filter( 'bricks/dynamic_data/post_terms_separator', function( $sep, $post, $taxonomy ) {
	return ' | ';
}, 10, 3 );

To remove the separator(s):

add_filter( 'bricks/dynamic_data/post_terms_separator', function( $sep, $post, $taxonomy ) {
	return '';
}, 10, 3 );

If you would like to limit to specific taxonomies:

add_filter( 'bricks/dynamic_data/post_terms_separator', function( $sep, $post, $taxonomy ) {
	if ( $taxonomy === 'testimonial_type' ) {
		return '';
	}

	return $sep;
}, 10, 3 );

where testimonial_type is the name of the taxonomy.

  • Niels Tieman

    Would this work on relationships as well? Currently they are shown as a list.

Leave your comment