• Resolved nicolasl

    (@nicolasl)


    I’m getting these errors when using the following sample code from your site. I’m using CFS v2.4.4.

    $field_data = array('first_name' => 'Bob', 'last_name' => 'Jones');
    $post_data = array('post_title' => 'My Post', 'post_type' => 'person');
    CFS()->save($field_data, $post_data);

    Errors:

    Notice: Undefined variable: parent_fields in ***/wp-content/plugins/custom-field-suite/includes/api.php on line 645
    
    Notice: Undefined variable: parent_fields in ***/wp-content/plugins/custom-field-suite/includes/api.php on line 645
    
    Notice: Undefined variable: fields in ***/wp-content/plugins/custom-field-suite/includes/api.php on line 686
    
    Notice: Undefined variable: field_id_lookup in ***/wp-content/plugins/custom-field-suite/includes/api.php on line 689
    
    Notice: Trying to get property of non-object in ***/wp-content/plugins/custom-field-suite/includes/api.php on line 723
    
    Notice: Undefined index: in ***/wp-content/plugins/custom-field-suite/includes/api.php on line 731
    
    Fatal error: Call to a member function pre_save() on a non-object in ***/wp-content/plugins/custom-field-suite/includes/api.php on line 731

    https://ww.wp.xz.cn/plugins/custom-field-suite/

Viewing 1 replies (of 1 total)
  • Plugin Author Matt Gibbs

    (@mgibbs189)

    Hi,

    You just need to make sure that the fields exist for the post type in question.

    The above example assumes that you have a CPT named “person”, and that there’s a field group attached to it with the fields “first_name” and “last_name”.

Viewing 1 replies (of 1 total)

The topic ‘Save() undefined variables etc’ is closed to new replies.