A Select Terms 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 Terms inherit from a Field, and an Item, then all settings described in Field Settings and Item Settings are also used.
Specific settings for Select Terms:
Select Terms Settings | Description |
---|---|
taxonomy string / Default: ‘category’ |
Taxonomy name, or array of taxonomies, to which results should be limited. Leave blank ” for any types |
object_ids array / Default: array() |
Object ID, or array of object IDs. Results will be limited to terms associated with these objects. |
orderby string / Default: ‘name’ |
Field(s) to order terms by. Accepts: term fields (‘name’, ‘slug’, ‘term_group’, ‘term_id’, ‘id’, ‘description’, ‘parent’, ‘term_order’)… 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’. |
hide_empty boolean / Default: true |
Whether to hide terms not assigned to any posts. Accepts 1|true or 0|false. Default 1|true. |
number int / Default: 0 |
Maximum number of terms to return. Accepts ”|0 (all) or any positive number. Default ”|0 (all) |
include array / Default: array() |
(int[]|string) Array or comma/space-separated string of term IDs to include. Default empty array. |
exclude array / Default: array() |
(int[]|string) Array or comma/space-separated string of term IDs to exclude. If $include is non-empty, $exclude is ignored. Default empty array. |
show_count boolean / Default: false |
Display count of attached posts type if true |