Cybo Advanced Field EngineCyboweb Technologies · Documentation · v1.0.2

Troubleshooting

cafe_get_field() returns null

  1. Is the field name right? Names are case-sensitive: hero_title ≠ Hero_Title.
  2. Is a value saved for this object? Check with cafe_has_field( 'hero_title', $post_id ).
  3. Is it the object you think? Outside the loop, pass the ID: cafe_get_field( 'hero_title', $post_id ). For terms and users pass the type: cafe_get_field( 'subtitle', $term_id, 'term' ).
  4. Is the field group in the trash? Trashed groups are ignored.

cafe_update_field() returns false

Ask the service for the reason:

$result = cafe()->fields()->update( 'hero_title', $value, $post_id );
var_dump( is_wp_error( $result ) ? $result->get_error_code() : $result );
Code Meaning
cafe_field_not_found No field with that name or key
cafe_invalid_object The post/term/user/comment does not exist, or CAFE could not work out which object you meant
cafe_text_too_long / cafe_text_too_short / cafe_invalid_text The value failed the field's validation
cafe_unknown_field_type The field's type is not registered (plugin providing it inactive?)
cafe_save_failed Database error; see the message

"The database update failed" notice

CAFE could not create or upgrade its tables. The notice shows the database error. Common causes: the database user lacks CREATE/ALTER rights, or InnoDB is disabled. Fix the cause and reload any admin page: CAFE retries automatically.

cafe() throws "has not been booted yet"

You called it before plugins loaded. Wrap your code in add_action( 'cafe_loaded', … ) or any later hook such as init.

Two field groups use the same field name

CAFE returns the one with a saved value for the object, otherwise the one in the group with the lowest order. Use the field key to pick one explicitly.