Cybo Advanced Field EngineCyboweb Technologies · Documentation · v1.0.2

cafe_get_option()

Purpose

Returns a value from the global options (site-wide settings such as a phone number).

Syntax

cafe_get_option( string $selector, mixed $default_value = null ): mixed

Parameters

Parameter Type Default Description
$selector string - Field name or field key.
$default_value mixed null Returned as-is when nothing is saved.

Return value

The saved, formatted value; otherwise $default_value, the field's Default Value, or null.

Example

$phone = cafe_get_option( 'company_phone' );

echo esc_html( $phone );

Notes

  • Same as cafe_get_field( $selector, 'option' ).
  • Values are usually edited on a Settings Page.
  • CAFE options are stored in CAFE's tables, not in wp_options.