Title: PHP warning about passing string, expected array
Last modified: October 20, 2019

---

# PHP warning about passing string, expected array

 *  Resolved [PWS](https://wordpress.org/support/users/perceptionweb/)
 * (@perceptionweb)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-warning-about-passing-string-expected-array/)
 * After updating to Live Chat 8.1.1 a PHP warning is displayed on front end pages
   from the plugin functions.php file, line 1851, indicating parameter 2 of the 
   in_array function is expecting an array, but received a string. This happens 
   in performing a check of the wplc_exclude_post_types setting. Trying to change‘
   Exclude chat window on selected post types’ under General Settings produces a
   fatal error.
 * The following code fixes the warning on the front end:
 *     ```
       function pws_fix_wplc_settings () {
           $wplc_settings = get_option('WPLC_SETTINGS');
           if ( isset($wplc_settings['wplc_exclude_post_types'])
               && ! is_array($wplc_settings['wplc_exclude_post_types'])
           ) {
               $wplc_settings['wplc_exclude_post_types'] = array();
               update_option('WPLC_SETTINGS', $wplc_settings);    
           }
       }
       add_action('init', 'pws_fix_wplc_settings', 10, 0);
       ```
   
 * However, the default setting is an empty string which still causes a fatal error
   when saving the settings: Fatal error: Uncaught Error: [] operator not supported
   for strings in wp-live-chat-support.php on line 3640. The default setting should
   probably be changed to an empty array.

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

 *  Plugin Author [wordpress3cx](https://wordpress.org/support/users/wordpress3cx/)
 * (@wordpress3cx)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-warning-about-passing-string-expected-array/#post-12048781)
 * Hello, thanks for your detailed feedback. This is a bug and will be fixed ASAP.
   Stay tuned for next release.
    You’ll get a notice when this is fixed.
 *  Plugin Author [wordpress3cx](https://wordpress.org/support/users/wordpress3cx/)
 * (@wordpress3cx)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-warning-about-passing-string-expected-array/#post-12060903)
 * This issue is fixed in new version 8.1.2. Let us know!
 *  Thread Starter [PWS](https://wordpress.org/support/users/perceptionweb/)
 * (@perceptionweb)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-warning-about-passing-string-expected-array/#post-12063321)
 * It’s working now. Thanks for the quick update.

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

The topic ‘PHP warning about passing string, expected array’ is closed to new replies.

 * ![](https://ps.w.org/wp-live-chat-support/assets/icon-256x256.png?rev=2405258)
 * [3CX Free Live Chat, Calls & Messaging](https://wordpress.org/plugins/wp-live-chat-support/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-live-chat-support/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-live-chat-support/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-live-chat-support/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-live-chat-support/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-live-chat-support/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [PWS](https://wordpress.org/support/users/perceptionweb/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/php-warning-about-passing-string-expected-array/#post-12063321)
 * Status: resolved