bp_get_member_types( array|string $args = array(), string $output = 'names', string $operator = 'and' )

Get a list of all registered member type objects.

Description Description

See also See also

Top ↑

Parameters Parameters


(array|string) (Optional) An array of key => value arguments to match against the member type objects.

Default value: array()


(string) (Optional) The type of output to return. Accepts 'names' or 'objects'.

Default value: 'names'


(string) (Optional) The logical operation to perform. 'or' means only one element from the array needs to match; 'and' means all elements must match. Accepts 'or' or 'and'.

Default value: 'and'

Top ↑

Return Return

(array) A list of member type names or objects.

Top ↑

Source Source

File: bp-members/bp-members-functions.php

function bp_get_member_types( $args = array(), $output = 'names', $operator = 'and' ) {
	$types = buddypress()->members->types;

	// Merge with types available into the database.
	if ( ! isset( $args['code'] ) || true !== $args['code'] ) {
		$types = bp_get_taxonomy_types( bp_get_member_type_tax_name(), $types );

	$types = wp_filter_object_list( $types, $args, $operator );

	 * Filters the array of member type objects.
	 * This filter is run before the $output filter has been applied, so that
	 * filtering functions have access to the entire member type objects.
	 * @since 2.2.0
	 * @param array  $types     Member type objects, keyed by name.
	 * @param array  $args      Array of key=>value arguments for filtering.
	 * @param string $operator  'or' to match any of $args, 'and' to require all.
	$types = apply_filters( 'bp_get_member_types', $types, $args, $operator );

	if ( 'names' === $output ) {
		$types = wp_list_pluck( $types, 'name' );

	return $types;

Top ↑

Changelog Changelog

Version Description
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.