Title: get_option returns false causing array warnings
Last modified: October 3, 2018

---

# get_option returns false causing array warnings

 *  [justindocforce](https://wordpress.org/support/users/justindocforce/)
 * (@justindocforce)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/get_option-returns-false-causing-array-warnings/)
 *     ```
       /**
        * Retrieves WP OAuth Server settings
        *
        * @param  [type] $key [description]
        *
        * @return [type]      [description]
        */
       function wo_setting( $key = null ) {
   
       	$default_settings = _WO()->defualt_settings;
       	$settings         = get_option( 'wo_options' );
       	$settings         = array_merge( $default_settings, array_filter( $settings, function ( $value ) {
       		return $value !== '';
       	} ) );
       ```
   
 * This code throws warnings whenever `get_option` returns `false`, meaning the 
   option did not already exist. This is a valid use case for the `get_option` function.
   The `array_filter` then throws a warning as you’re passing a boolean to a function
   that accepts an array. After that, `array_merge` throws another warning as you’re
   then passing that same boolean to it when it expects an array.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * (@justingreerbbi)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/get_option-returns-false-causing-array-warnings/#post-10811416)
 * Thank you for reporting this issue. It has been marked down on our check list
   to updates for the plugin.

Viewing 1 replies (of 1 total)

The topic ‘get_option returns false causing array warnings’ is closed to new replies.

 * ![](https://ps.w.org/oauth2-provider/assets/icon-256x256.gif?rev=2603051)
 * [WP OAuth Server (OAuth Authentication)](https://wordpress.org/plugins/oauth2-provider/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/oauth2-provider/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/oauth2-provider/)
 * [Active Topics](https://wordpress.org/support/plugin/oauth2-provider/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/oauth2-provider/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/oauth2-provider/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Justin Greer](https://wordpress.org/support/users/justingreerbbi/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/get_option-returns-false-causing-array-warnings/#post-10811416)
 * Status: not resolved