acf_get_valid_bidirectional_target_types()
Allows third party fields to enable support as a target field type for a particular object type
Хуки из функции
Возвращает
array. An array of valid field type names (slugs) for the target of the bidirectional field.
Использование
acf_get_valid_bidirectional_target_types( $object_type );
- $object_type(строка) (обязательный)
- The object type that will be updated on the target field, such as
'term','user'or'post'.
Список изменений
| С версии 6.2 | Введена. |
Код acf_get_valid_bidirectional_target_types() acf get valid bidirectional target types 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 );
}