Title: Bug fix for reading options
Last modified: August 30, 2016

---

# Bug fix for reading options

 *  [wunch](https://wordpress.org/support/users/wunch/)
 * (@wunch)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/bug-fix-for-reading-options/)
 * The grid view in my Media Library was not loading. This was driving me crazy,
   but I finally figured it out.
 * Issue: When the setting hide_cropped is unchecked and WP_DEBUG is true, the grid
   view of the Media library in the admin interface never loads.
 * Cause: Errors get printed to the admin-ajax response, which is expecting json,
   and as a result just shows nothing. Looking at the actual ajax response, the 
   errors have to do with ACF-image-crop trying to access a non-existent array index.
 * Versions: WP 4.4 + ACF 4.4.4 + ACF-image-crop 1.4.7
 * >  Warning: Illegal string offset ‘hide_cropped’ in /var/www/arc/web/app/plugins/
   > acf-image-crop-add-on/acf-image-crop-v4.php on line 895
   >  Notice: Uninitialized
   > string offset: 0 in /var/www/arc/web/app/plugins/acf-image-crop-add-on/acf-
   > image-crop-v4.php on line 895
 * Fix: check to see that the result from get_options() is an array and that the
   array index actually exists:
 * Change line 895 from
    `$hide = $options['hide_cropped'];` to `$hide = (is_array(
   $options) && array_key_exists('hide_cropped', $options)) ? $options['hide_cropped']:
   false;`
 * Incidentally, a similar thing needs to be done for the actual checkboxes on the
   settings page:
 * >  Warning: Illegal string offset ‘hide_cropped’ in /var/www/arc/web/app/plugins/
   > acf-image-crop-add-on/acf-image-crop-v4.php on line 943
   >  Notice: Uninitialized
   > string offset: 0 in /var/www/arc/web/app/plugins/acf-image-crop-add-on/acf-
   > image-crop-v4.php on line 943 Warning: Illegal string offset ‘retina_mode’ 
   > in /var/www/arc/web/app/plugins/acf-image-crop-add-on/acf-image-crop-v4.php
   > on line 955 Notice: Uninitialized string offset: 0 in /var/www/arc/web/app/
   > plugins/acf-image-crop-add-on/acf-image-crop-v4.php on line 955
 * Change line 943 from
    `$value = $options['hide_cropped'];` to `$value = (is_array(
   $options) && array_key_exists('hide_cropped', $options)) ? $options['hide_cropped']:
   false;`
 * and change line 955 from
    `$value = $options['retina_mode'];` to `$value = (is_array(
   $options) && array_key_exists('retina_mode', $options)) ? $options['retina_mode']:
   false;`
 * [https://wordpress.org/plugins/acf-image-crop-add-on/](https://wordpress.org/plugins/acf-image-crop-add-on/)

The topic ‘Bug fix for reading options’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/acf-image-crop-add-on_e1e1e1.svg)
 * [Advanced Custom Fields: Image Crop Add-on](https://wordpress.org/plugins/acf-image-crop-add-on/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-image-crop-add-on/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-image-crop-add-on/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-image-crop-add-on/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-image-crop-add-on/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-image-crop-add-on/reviews/)

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)
 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [bugfix](https://wordpress.org/support/topic-tag/bugfix/)
 * [media library](https://wordpress.org/support/topic-tag/media-library/)

 * 0 replies
 * 1 participant
 * Last reply from: [wunch](https://wordpress.org/support/users/wunch/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/bug-fix-for-reading-options/)
 * Status: not resolved