Site docs are currently being updated 🚧 Thank you for your patience! 🙏

Link

ACF
Last Upated: Thursday, Feb 1, 2024

link

The Link field is native to ACF (FREE) and allows a link to be selected or defined (url, title, target) by using the native WordPress link popup.

Types Added to the Schema

To support the Link Field, an additional Object Type is added to the Schema.

  • AcfLink (object type): Object representing a link, with fields such as target, title and url.

Resolve Type

Fields of the Link type will resolve to the AcfLink type in the Schema.

Field Settings

Field Configuration

<?php
add_action( 'acf/include_fields', function() {
if ( ! function_exists( 'acf_add_local_field_group' ) ) {
return;
}
acf_add_local_field_group(
[
{
"key": "my_field_group_",
"title": "My Field Group with link",
"show_in_graphql": 1,
"graphql_field_name": "myFieldGroupWithLink",
"map_graphql_types_from_location_rules": 0,
"graphql_types": [
"Page"
],
"fields": [
{
"key": "my_field_",
"label": "My Field",
"name": "my_field",
"type": "link",
"show_in_graphql": 1,
"graphql_field_name": "myFieldWithLink"
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "page"
}
]
]
}
]
);
});