Cybo Advanced Field EngineCyboweb Technologies · Documentation · v1.0.2

Taxonomy field

Purpose

One or more terms of a taxonomy: categories, tags, product categories.

Field type name

taxonomy

Settings

Setting Description
Instructions Shown to editors below the field label. (max 2000 characters)
Taxonomy The taxonomy editors choose terms from.
Select Multiple Let editors choose more than one term; the value becomes a list.
Save Terms On posts (top level): saving the field also sets the post's terms of this taxonomy, in the same transaction.
Load Terms On posts (top level): read the value from the post's terms of this taxonomy instead of CAFE storage.
Return Format object (WP_Term) or id.
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

WP_Term (or its ID), null when empty; a list with Select Multiple. With WPML, the term's translation in the current language when it exists.

Example

foreach ( (array) cafe_get_field( 'topics' ) as $term ) {
	printf( '<a href="%s">%s</a> ', esc_url( get_term_link( $term ) ), esc_html( $term->name ) );
}

Editing

A search box with a list that opens when it gets focus. The chosen items and the first 20 terms 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. 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=…, with a "Searching…" row while waiting. See REST.