• WP Migrate
  • WP Offload Media
  • WP Offload SES
  • About
  • Podcast
  • Advanced Custom Fields

  • Documentation
  • PRO
  • Blog
  • Support
  • Account
  • Purchase
  • WP Migrate
  • WP Offload Media
  • WP Offload SES

Page Link

Documentation Field Types Page Link

Description

The Post Object field creates an interactive drop-down to select one or more posts, pages, custom post type items or archive URLs. This field type uses the Select2 library to enable search and AJAX functionality.

Screenshots

A Page Link field that allows you to choose an existing post, page,CPT or archive URL from a list
The Page Link field interface
List of field settings shown when setting up a Page Link field
The Page Link field settings

Changelog

  • Added Allow Archives in version 5.4.0.
  • Added Select2 UI in version 5.0.0.

Settings

  • Filter by Post Type
    Filters the selectable results via one or more post type. When left empty, all post types will be shown. As results are grouped by their post type, the selected post types here may be positioned into a specific order.

  • Filter by Taxonomy
    Filters the selectable results via one or more taxonomy term.

  • Allow Null
    Allows the current selection to be cleared and an empty value to be saved.

  • Allow Archives URLs
    Includes post type archive URLs within the select list of options.

  • Multiple
    Allows you to select more than one choice. When enabled, you may also drag/drop to reorder the selected choices.

Template usage

The Page Link field will return either a single URL or array of URLs. To get more data from a selected post, please use the post object field instead.

Display single value

This example demonstrates how to display a selected page link value.

<a href="<?php the_field('page_link'); ?>">Continue reading</a>

Display multiple values

This example demonstrates how to load and display multiple selected page link values.

<?php 
$urls = get_field('urls');
if( $urls ): ?>
    <h3>Further reading</h3>
    <ul>
        <?php foreach( $urls as $url ): ?>
        <li>
            <a href="<?php echo esc_url( $url ); ?>"><?php echo esc_html( $url ); ?></a>
        </li>
        <?php endforeach; ?>
    </ul>
<?php endif; ?>

On this page

    In this category

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

    About

    • PRO
    • Blog
    • Account

    Help

    • Docs
    • FAQs
    • Forums
    • Contact
    • Changelog

    Community

    • WordPress
    • Github
    • Twitter
    • AwesomeACF

    Products

    • WP Migrate
    • WP Offload Media
    • WP Offload SES

    © 2023 Delicious Brains Inc. All rights reserved.

    Privacy Policy | Terms and Conditions

    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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.

    Got it