Title: get_theme_mod array error
Last modified: October 9, 2017

---

# get_theme_mod array error

 *  Resolved [kenryu](https://wordpress.org/support/users/kenryu/)
 * (@kenryu)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/)
 * Thanks for a great theme. Could you please help me resolve a problem? I receive
   error message when using wp-cli.
 * $ wp-cli
    PHP Warning: array_key_exists() expects parameter 2 to be array, null
   given in /var/www/mysite.com/dev/wp-content/themes/vega/functions.php on line
   428 Warning: array_key_exists() expects parameter 2 to be array, null given in/
   var/www/mysite.com/dev/wp-content/themes/vega/functions.php on line 428
 * I have not modified functions.php file. Line #428 is ” $value = get_theme_mod(
   $key, $vega_wp_defaults[$key]); “. Code block:
 * #vega_wp_get_option
    if ( ! function_exists( ‘vega_wp_get_option’ ) ) : function
   vega_wp_get_option($key){ global $vega_wp_defaults; if (array_key_exists($key,
   $vega_wp_defaults)) $value = get_theme_mod($key, $vega_wp_defaults[$key]); else
   $value = get_theme_mod($key); return $value; } endif;
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fget_theme_mod-array-error%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Rico Mossesgeld](https://wordpress.org/support/users/ricotheque/)
 * (@ricotheque)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9573425)
 * Hey [@kenryu](https://wordpress.org/support/users/kenryu/), I’m [@ricotheque](https://wordpress.org/support/users/ricotheque/)
   from LyraThemes. (Hadouken!)
 * Sounds like the database has been corrupted. Since you’re using WP-CLI, could
   you try this? [https://developer.wordpress.org/cli/commands/theme/mod/remove/](https://developer.wordpress.org/cli/commands/theme/mod/remove/)
 * Note that this will clear any options you may have set for your test site’s Customizer.
 * Hope this helps!
 *  Thread Starter [kenryu](https://wordpress.org/support/users/kenryu/)
 * (@kenryu)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9573615)
 * Hi [@ricotheque](https://wordpress.org/support/users/ricotheque/). I tried your
   suggestion but still have error.
 *     ```
       $ wp-cli theme mod remove --all
       PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in /var/www/mysite.com/dev/wp-content/themes/vega/functions.php on line 428
       Success: Theme mods removed.
       ```
   
 *     ```
       $ wp-cli
       PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in /var/www/mysite.com/dev/wp-content/themes/vega/functions.php on line 428
       ```
   
 * What else could I check?
 *  [Rico Mossesgeld](https://wordpress.org/support/users/ricotheque/)
 * (@ricotheque)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9582831)
 * Hey [@kenryu](https://wordpress.org/support/users/kenryu/), could you try reinstalling
   the Vega theme? It’s possible that it got corrupted.
 * Failing that, can you try a fresh WordPress install and see if that fixes things?
 *  Theme Author [lyrathemes](https://wordpress.org/support/users/lyrathemes/)
 * (@lyrathemes)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9582887)
 * Hi [@kenryu](https://wordpress.org/support/users/kenryu/) – line 428, can you
   confirm what that is?
 * `if (array_key_exists($key, $vega_wp_defaults))`
 * Parameter two is an array $vega_wp_defaults, which should be defined in the file`
   customize/theme-defaults.php`. Please rewrite all the files in your `vega` theme
   folder and see if that helps.
 *  Thread Starter [kenryu](https://wordpress.org/support/users/kenryu/)
 * (@kenryu)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9582930)
 * Hi [@ricotheque](https://wordpress.org/support/users/ricotheque/). I deleted 
   and reinstalled the Vega theme, but still have error.
 * I’m afraid a fresh WordPress install will impact the other 3 test sites I am 
   working on.
 *  Thread Starter [kenryu](https://wordpress.org/support/users/kenryu/)
 * (@kenryu)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9582934)
 * Hi [@lyrathemes](https://wordpress.org/support/users/lyrathemes/).
 * Error line in functions.php is:
    `if (array_key_exists($key, $vega_wp_defaults))`
 * I reinstalled the Vega theme folder but still have same error.
    -  This reply was modified 8 years, 7 months ago by [kenryu](https://wordpress.org/support/users/kenryu/).
 *  Theme Author [lyrathemes](https://wordpress.org/support/users/lyrathemes/)
 * (@lyrathemes)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9582957)
 * Is there any reason why a global variable would not be visible inside a function?
   Looks like this is the way wp-cli is loaded. See [https://github.com/wp-cli/wp-cli/issues/2200](https://github.com/wp-cli/wp-cli/issues/2200)
 * You can add this line to the beginning of customize/theme-defaults.php:
 *  `global $vega_wp_defaults;`
 *  Thread Starter [kenryu](https://wordpress.org/support/users/kenryu/)
 * (@kenryu)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9584885)
 * Hi [@lyrathemes](https://wordpress.org/support/users/lyrathemes/). Your suggestion
   solved my problem. I now understand it to be a limitation of wp-cli and not the
   theme. Thank you!
 *  Theme Author [lyrathemes](https://wordpress.org/support/users/lyrathemes/)
 * (@lyrathemes)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9585002)
 * I am glad that worked out!!

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

The topic ‘get_theme_mod array error’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/vega/3.0.0/screenshot.jpg)
 * Vega
 * [Support Threads](https://wordpress.org/support/theme/vega/)
 * [Active Topics](https://wordpress.org/support/theme/vega/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/vega/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/vega/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [lyrathemes](https://wordpress.org/support/users/lyrathemes/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/get_theme_mod-array-error/#post-9585002)
 * Status: resolved