Page Link field
Purpose
A link to a page (or post of any type) of this site, returned as its URL. The page is stored as a reference, so the link follows it when its slug or parent changes.
Field type name
page_link
Settings
| Setting | Description |
|---|---|
| Instructions | Shown to editors below the field label. (max 2000 characters) |
| Post Types | Post types editors can choose from (e.g. ["page", "product"]). Empty = every public post type. |
| Post Status | Only offer posts with these statuses (e.g. ["publish"]). Empty = any status except trash and auto-draft. |
| Filter by Taxonomy | Only offer posts in one of these terms, written taxonomy:slug (e.g. category:news). Applies to the picker. |
| Select Multiple | Let editors choose more than one page; the value becomes a list of URLs. |
| Translation | How the field behaves in other languages: translate, copy, copy_once or do_not_translate. Used on top-level fields when WPML is active. See WPML. |
| Width | Width on edit screens, to place fields side by side: 100 (full), 75, 66, 50, 33 or 25 (%). Phones always show full width. |
| Label per language | The label and instructions per language code while editing in that language. Set on the Translation tab when WPML is active. See WPML. |
PHP return value
The permalink (string), null when empty; a list of URLs with Select Multiple. Deleted or trashed pages give no URL.
Example
$url = cafe_get_field( 'more_info' );
if ( $url ) {
echo '<a href="' . esc_url( $url ) . '">' . esc_html__( 'Read more', 'my-theme' ) . '</a>';
}
Editing
A search box with a list that opens when it gets focus. The chosen items and the first 20 items of the list are printed with the edit screen,
so the list opens at once, with no request. When those 20 are all there is, typing
filters them in the browser (case- and accent-insensitive) and the server is never
asked. Longer lists are searched on the server as the editor types (debounced, 20 per
page, "Load more" for the next page) through
GET /cafe/v1/references?field={key}&search=…&page=…; the current list stays visible
with a "Searching…" row until the answer arrives. The object being edited is never
offered. See REST.