Skip to content
Ultivo Toolkit 1.0 is here! Get 10% off your first year with LAUNCH10 until September 30. See pricing
Documentation menu

Options, users & terms

Options pages#

ultivo_add_options_page() registers a settings page in the admin that isn't tied to any post. Attach a field group to it with the "Options page" location rule, then read the values with the normal API.

ultivo_add_options_page( 'Site settings' );

Or the array form, for more control over the menu placement:

ultivo_add_options_page( [
    'page_title'  => 'Site settings',
    'menu_slug'   => 'site-settings',
    'parent_slug' => '',
    'capability'  => 'manage_options',
    'icon_url'    => 'dashicons-admin-generic',
] );

Reading a field from an options page passes "options" (or "option") as the $post_id:

$phone = ultivo_field( 'company_phone', 'options' );

User and term fields#

A field group can target user profile screens or taxonomy term-edit screens through the same location rule builder. See Location rules for the "User form" / "User role" and "Taxonomy term" rules.

Once attached, read and write those fields with the "user_{id}" and "term_{id}" conventions:

$bio = ultivo_field( 'bio', 'user_5' );
ultivo_update_field( 'bio', 'Updated bio', 'user_5' );

$intro = ultivo_field( 'intro', 'term_9' );

Storage#

Values saved to an options page are stored as regular WordPress options, named {prefix}_{name}, where the prefix comes from the options page context. User and term fields are stored in user meta and term meta respectively, using the same field_name / _field_name pattern posts use (see Builder basics).