acf_get_valid_bidirectional_target_types()
Allows third party fields to enable support as a target field type for a particular object type
Hooks from the function
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() 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 );
}