• Advanced Custom Fields

  • PRO
  • Documentation
  • Blog
  • Support
  • Account
  • Purchase
  • Download

Link

Documentation Field Types Link

Last updated Feb 17, 2022

Description

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

Screenshots

A Link field that allows you to enter a new URL or choose an existing link from a list
The Link field interface
List of field settings shown when setting up a Link field
The Link field settings

Changelog

  • Added in version 5.6.0.

Settings

  • Return value
    Specifies the format of the returned data. Choose from Link Array (array of data) or Link URL (string).

Template usage

The Link field will return either an array or string depending on the return value setting. Below are some examples of how you can use this data.

Basic Display (array)

This example demonstrates how to display the selected link when using the Link Array return type.

<?php 
$link = get_field('link');
if( $link ): 
    $link_url = $link['url'];
    $link_title = $link['title'];
    $link_target = $link['target'] ? $link['target'] : '_self';
    ?>
    <a class="button" href="<?php echo esc_url( $link_url ); ?>" target="<?php echo esc_attr( $link_target ); ?>"><?php echo esc_html( $link_title ); ?></a>
<?php endif; ?>

Basic display (string)

This example demonstrates how to display the selected link when using the Link URL return type.

<?php 
$link = get_field('link');
if( $link ): ?>
    <a class="button" href="<?php echo esc_url( $link ); ?>">Continue Reading</a>
<?php endif; ?>
Supercharge Your Website With Premium Features Using ACF PRO

Speed up your workflow and unlock features to better develop websites using ACF Blocks and Options Pages, with the Flexible Content, Repeater, Clone, Gallery Fields & More.

Explore Features View Pricing

PRO Features
ACF Blocks
Options Pages
PRO Fields
Repeater
Flexible Content
Gallery
Clone

Related

  • Content: File
  • Content: Image
  • Field Types: Page Link
  • Choice: Button Group
  • Choice: Radio Button

On this page

    In this category

    • Accordion
    • Button Group
    • Checkbox
    • Clone
    • Color Picker
    • Date Picker
    • Date Time Picker
    • Email
    • File
    • Flexible Content
    • Gallery
    • Google Map
    • Group
    • Icon Picker
    • Image
    • Link
    • Number
    • oEmbed
    • Page Link
    • Password
    • Post Object
    • Radio Button
    • Range
    • Relationship
    • Repeater
    • Select
    • Tab
    • Taxonomy
    • Text
    • Text Area
    • Time Picker
    • True / False
    • URL
    • User
    • Wysiwyg Editor

    Supercharge Your Website With Premium Features Using ACF PRO

    Do more, build bigger, and extend further with features that unlock all the potential of WordPress.

    Explore Features

    Sign up for the latest Advanced Custom Fields news, updates, and developer tutorials

    Build smarter, faster, better with ACF®

    About

    • PRO
    • About Us
    • Blog
    • Account
    • Changelog
    • Status

    Help

    • Docs
    • FAQs
    • Forums
    • Contact
    • Feedback
    • Security

    Community

    • Download ACF
    • GitHub
    • ACF Chat Fridays
    • Twitter

    Products

    • WP Engine Hosting
    • WP Migrate
    • WP Offload Media
    • WP Offload SES

    © 2025 WPEngine, Inc. All rights reserved.

    Privacy Policy | Terms and Conditions

    1WP Engine is a proud member and supporter of the community of WordPress® users. The WordPress® trademarks are the intellectual property of the WordPress Foundation, and the Woo® and WooCommerce® trademarks are the intellectual property of WooCommerce, Inc. Uses of the WordPress®, Woo®, and WooCommerce® names in this website are for identification purposes only and do not imply an endorsement by WordPress Foundation or WooCommerce, Inc. WP Engine is not endorsed or owned by, or affiliated with, the WordPress Foundation or WooCommerce, Inc.

    We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.

    Got it