Support

Account

Home Forums Reply To:

  • I’m struggling with this and the documentation doesn’t really make it clear…

    I have the following field types in a field group placed on a Taxonomy “company”…

    • Group: “Categories”, org_categories
    • Checkbox: “Sector”, org_cat_sector
    • Checkbox: “Industry Group”, org_cat_industrygroup
    • Checkbox: “Industry”, org_cat_industry

    How do I save values in to those checkboxes?

    $org_id_prefixed = 'company_'. $organisation->term_id; already gives the prefixed ID.

    Elsewhere, I’m successfully using the following to save to a Checkbox that is NOT in a Group…

    // Save "tags" (array) in ACF "org_tags" (checkbox)
    update_field('org_tags', $json_string->tags, $org_id_prefixed);

    What I want to save to org_cat_sector is $json_string->category->sector

    Most of the documentation around update_sub_field refers to Repeater. I’m unclear if I need to use have_rows stuff.

    The following…

    update_sub_field(
    array(‘org_categories’, 1, ‘org_cat_sector’), // Selector
    $json_string->category->industryGroup, // Value
    $org_id_prefixed // Object ID
    );

    … results in PHP throwing: ( ! ) Warning: Invalid argument supplied for foreach() in /home/myfolder/public_html/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-checkbox.php on line 490