array_key_exists() expects parameter 2 to be array

Shan Ki picture Shan Ki · Jun 2, 2015 · Viewed 8.6k times · Source

My Wordpress page (yarnhk.com) appears the following lines:

Warning: array_key_exists() expects parameter 2 to be array, string given in /home/yarnhrnm/public_html/wp-content/plugins/fusion-core/shortcodes/class-fullwidth.php on line 482

Warning: array_key_exists() expects parameter 2 to be array, string given in /home/yarnhrnm/public_html/wp-content/plugins/fusion-core/shortcodes/class-fullwidth.php on line 483

The fullwidth.php file line 482 & 483 show as follows:

if ( ( array_key_exists( 'backgroundattachment', $args ) 
   && $args['backgroundattachment'] == 'scroll' ) 
   || ( array_key_exists( 'background_attachment', $args ) 
   && $args['background_attachment'] == 'scroll' )

Any help here?

Answer

Richard picture Richard · Jun 2, 2015

parameter 2 to be array, string given

The error message says, that your $args is not an array but a normal string. Look for the definition of the variable (and - of course - for any accident overwriting).

You should use var_dump($args); to output the type and the value of $args.