Title: Error when returning only the value
Last modified: October 30, 2018

---

# Error when returning only the value

 *  [phinn](https://wordpress.org/support/users/phinn/)
 * (@phinn)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/error-when-returning-only-the-value/)
 * Hello,
    I’m using ACF 5.7.7 and I have my color swatch field set to return only
   the value. This gives an `Illegal string offset 'value'` for line 394 `if (in_array(
   $value['value'], $map_to_transparent)) {` I changed it to check if it was an 
   array first and it solves the issue `if (is_array($value) && in_array($value['
   value'], $map_to_transparent)) {`
 * thanks for the nice plugin

Viewing 1 replies (of 1 total)

 *  [darkcodes](https://wordpress.org/support/users/darkcodes/)
 * (@darkcodes)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/error-when-returning-only-the-value/#post-10903767)
 * Here is my solutions
 * At line 399 replace:
 *     ```
       // Replace values which should be returned as transparent
       if (in_array($value['value'], $map_to_transparent)) {
           $value['value'] = 'transparent';
       }
       ```
   
 * With:
 *     ```
       if (is_array($value) && array_key_exists('value', $value)
           && in_array($value['value'], $map_to_transparent)) {
           // Replace values which should be returned as transparent
           $value['value'] = 'transparent';
       } elseif (in_array($value, $map_to_transparent)) {
           $value          = [];
           $value['value'] = 'transparent';
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Error when returning only the value’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/acf-color-swatches.svg)
 * [ACF Color Swatches](https://wordpress.org/plugins/acf-color-swatches/)
 * [Support Threads](https://wordpress.org/support/plugin/acf-color-swatches/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-color-swatches/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-color-swatches/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-color-swatches/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [darkcodes](https://wordpress.org/support/users/darkcodes/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/error-when-returning-only-the-value/#post-10903767)
 * Status: not a support question