Title: Fatal error in Customizer: in_array() expects array, string given (PHP 8+)
Last modified: December 5, 2025

---

# Fatal error in Customizer: in_array() expects array, string given (PHP 8+)

 *  Resolved [grwebadmin](https://wordpress.org/support/users/grwebadmin/)
 * (@grwebadmin)
 * [5 months, 3 weeks ago](https://wordpress.org/support/topic/fatal-error-in-customizer-in_array-expects-array-string-given-php-8/)
 * Hello,
 * We are experiencing a fatal PHP error that completely breaks the WordPress Customizer
   when the Beautiful Taxonomy Filters plugin is active.
 * We see this screen:
 * ![](https://i0.wp.com/awesomescreenshot.s3.amazonaws.com/image/5272669/57759358-
   158dc7badd9f97e79747eb473d410090.png?ssl=1)
 * **Environment**
    - WordPress: Latest version
    - Theme: Astra 4.11.16
    - PHP Version: 8+
    - Plugin: Beautiful Taxonomy Filters
    - Issue occurs when navigating to Appearance → Customize
 * We also receive an email with the following error:
 *     ```wp-block-code
       An error of type E_ERROR was caused in line 107 of the file /nas/content/live/astra-theme-ext/wp-content/plugins/beautiful-taxonomy-filters/widgets/beautiful-taxonomy-filters-widget.php. Error message: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in /nas/content/live/astra-theme-ext/wp-content/plugins/beautiful-taxonomy-filters/widgets/beautiful-taxonomy-filters-widget.php:107Stack trace:#0 /nas/content/live/astra-theme-ext/wp-content/plugins/beautiful-taxonomy-filters/widgets/beautiful-taxonomy-filters-widget.php(107): in_array('elementor_libra...', '')#1 /nas/content/live/astra-theme-ext/wp-includes/class-wp-widget.php(535): Beautiful_Taxonomy_Filters_Widget->form(Array)#2 /nas/content/live/astra-theme-ext/wp-admin/includes/widgets.php(276): WP_Widget->form_callback(Array)#3 /nas/content/live/astra-theme-ext/wp-includes/class-wp-customize-widgets.php(1169): wp_widget_control(Array, Array)#4 /nas/content/live/astra-theme-ext/wp-includes/class-wp-customize-widgets.php(1117): WP_Customize_Widgets->get_widget_control(Array)#5 /nas/content/live/astra-theme-ext/wp-includes/class-wp-customize-widgets.php(714): WP_Customize_Widgets->get_available_widgets()#6 /nas/content/live/astra-theme-ext/wp-includes/class-wp-hook.php(324): WP_Customize_Widgets->enqueue_scripts('')#7 /nas/content/live/astra-theme-ext/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)#8 /nas/content/live/astra-theme-ext/wp-includes/plugin.php(517): WP_Hook->do_action(Array)#9 /nas/content/live/astra-theme-ext/wp-admin/customize.php(133): do_action('customize_contr...')#10 {main}  thrown
       ```
   
 * **Description of the Issue**
 * Inside `beautiful-taxonomy-filters-widget.php` on line 107, the plugin calls `
   in_array()` on a variable that is assumed to be an array. However, under certain
   conditions (such as when the Customizer loads widget controls), WordPress supplies
   a string or an empty value instead of an array. This results in a PHP 8+ TypeError
   that prevents:
    - Access to the Customizer
    - Widget screen loading
    - Theme customization
 * This makes it impossible to manage the site’s design while the plugin is active.
 * At the moment, this error completely blocks the Customizer, which is a critical
   part of WordPress administration. Any assistance or patch would be greatly appreciated.
 * Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Jonathandejong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [5 months, 3 weeks ago](https://wordpress.org/support/topic/fatal-error-in-customizer-in_array-expects-array-string-given-php-8/#post-18744373)
 * [@grwebadmin](https://wordpress.org/support/users/grwebadmin/)
 * Hi! 
   Thank you for reporting this. I think the error is actually that for some
   reason the option don’t get loaded or you have never saved the settings and the
   plugin assumes it will exist as an array.
 * Either that, or you have made modifications using the beautiful_filters_post_types
   and do not return an array to it but rather a string.
 *     ```wp-block-code
       <?php$post_types = get_post_types(array('public' => true,'_builtin' => false),'objects');$activated_post_types = apply_filters( 'beautiful_filters_post_types', get_option('beautiful_taxonomy_filters_post_types') );?><?php if($post_types): foreach($post_types as $single_post_type): ?>// HERE IS WHERE THE ERROR OCCURS BECAUSE $activated_post_types is not an array.<?php if(in_array($single_post_type->name, $activated_post_types)): ?>
       ```
   
 * I’ve just pushed a new bugfix version 2.4.6 which should resolve this by both
   adding a fallback value to get_option and a type coercion into an array.
 * Still, I would suggest you check that you don’t use the filter and return a string.
 *  Thread Starter [grwebadmin](https://wordpress.org/support/users/grwebadmin/)
 * (@grwebadmin)
 * [5 months, 3 weeks ago](https://wordpress.org/support/topic/fatal-error-in-customizer-in_array-expects-array-string-given-php-8/#post-18744475)
 * Yes it worked fine – thank you for the quick response.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffatal-error-in-customizer-in_array-expects-array-string-given-php-8%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/beautiful-taxonomy-filters/assets/icon-256x256.png?rev=1654967)
 * [Beautiful taxonomy filters](https://wordpress.org/plugins/beautiful-taxonomy-filters/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/beautiful-taxonomy-filters/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/)
 * [Active Topics](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [grwebadmin](https://wordpress.org/support/users/grwebadmin/)
 * Last activity: [5 months, 3 weeks ago](https://wordpress.org/support/topic/fatal-error-in-customizer-in_array-expects-array-string-given-php-8/#post-18744475)
 * Status: resolved