bp_set_registered_by_code_member_type_metadata( $metadata = array(),  $type = '' )

Generates missing metadata for a type registered by code.


Return Return

(array) The member type metadata.


Source Source

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

function bp_set_registered_by_code_member_type_metadata( $metadata = array(), $type = '' ) {
	$member_type = bp_get_member_type_object( $type );

	foreach ( get_object_vars( $member_type ) as $object_key => $object_value ) {
		if ( 'labels' === $object_key ) {
			foreach ( $object_value as $label_key => $label_value ) {
				$metadata[ 'bp_type_' . $label_key ] = $label_value;
			}
		} elseif ( ! in_array( $object_key, array( 'name', 'code', 'db_id' ), true ) ) {
			$metadata[ 'bp_type_' . $object_key ] = $object_value;
		}
	}

	/**
	 * Save metadata into database to avoid generating metadata
	 * each time a type is listed into the Types Admin screen.
	 */
	if ( isset( $member_type->db_id ) && $member_type->db_id ) {
		bp_update_type_metadata( $member_type->db_id, bp_get_member_type_tax_name(), $metadata );
	}

	return $metadata;
}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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