Skip to content

Post Input v3.24

Enables to reference posts through a search interface.

js
{
  input: {
    type: 'post', 
    postTypes: ['page', 'post']
  }
}

INFO

It is recommended to use the post input type instead of the relation input type for post references. There are several advantages:

  • you don't need to expose your post types in the REST API
  • simpler and less error-prone input API
  • the ability to handle larger amount of items

Input Options

OptionValuesDefaultDescription
postTypesstring[]['page', 'post']Define post types of relation.
placeholderstring'Element suchen'Text displayed as search input placeholder.
multiplebooleanfalseWhether multiple posts can be selected.
allowDuplicatesbooleantrueWhether duplicate posts can be added if multiple is true.
editLinkstring | booleantrueDeclare edit link for individual posts, %s will be replaced with its post ID. If set to false, edit links will be disabled. If set to true, a default edit link will be determined automatically.

Value Format

The value of the post input is an object of the following shape (or an array thereof, if multiple is true):

js
{
  id: 123,
  label: 'My Post',
  type: 'my-post-type', // post type name
  permalink: '/my-post/',
}

WARNING

If you switch from a relation input to the post input, make sure that your template function does not use the payload property, as this property is not available in the post input value format!

Conditions

The post input type supports the following conditions for dynamic visibility:

ConditionPayloadDescription
isEmptyboolean
defaults to true
Checks whether a post has been selected or not.