A Select Posts field can be inserted in:
- an Admin Page, as an option or a user_meta
- a User Profile, as a user_meta
- a Metabox, as a post_meta
The code below is used to generate this section in an Admin Page, for an option:
Copy to Clipboard
A Select Posts inherit from a Field, and an Item, then all settings described in Field Settings and Item Settings are also used.
Specific settings for Select Posts:
Select Posts Settings | Description |
---|---|
post_type string / Default: ‘any’ |
Type of post, can be any built_in like poge, post, product, my_custom_post_type … Leave ‘any’ for any types |
posts_per_page int / Default: -1 |
Number of posts to be displayed. Leave -1 for all results |
post_status string / Default: ‘any’ |
Status of post, like publish, draft… Leave ‘any’ for any status |
orderby string / Default: ‘post_date’ |
Use any database field value Leave blank ” for any status |
order string / Default: ‘ASC’ |
Whether to order terms in ascending or descending order. Accepts ‘ASC’ (ascending) or ‘DESC’ (descending). Default ‘ASC’. |
post__in string | array / Default: array() |
Use post ids. Specify posts to retrieve. Note: you cannot combine post__in and post__not_in in the same query. Leave empty array or blank ” not to use it |
post__not_in string | array / Default: array() |
Use post ids. Specify posts NOT to retrieve. Note: you cannot combine post__in and post__not_in in the same query. Leave empty array or blank ” not to use it |
slug boolean / Default: true |
Set to true to add the slug of the post in the displayed value |