acf_get_valid_bidirectional_target_types() │ ACF 6.2

Allows third party fields to enable support as a target field type for a particular object type

Returns

array. An array of valid field type names (slugs) for the target of the bidirectional field.

Usage

acf_get_valid_bidirectional_target_types( $object_type );
$object_type(string) (required)
The object type that will be updated on the target field, such as 'term', 'user' or 'post'.

Changelog

Since 6.2 Introduced.

acf_get_valid_bidirectional_target_types() code ACF 6.8.8

function acf_get_valid_bidirectional_target_types( $object_type ) {
	$valid_target_types = array();
	switch ( $object_type ) {
		case 'term':
			$valid_target_types = array( 'taxonomy' );
			break;
		case 'user':
			$valid_target_types = array( 'user' );
			break;
		case 'post':
			$valid_target_types = array( 'relationship', 'post_object' );
			break;
	}
	return apply_filters( 'acf/bidirectional/supported_field_types_for_post', $valid_target_types, $object_type );
}