cardnaul
Member
Posted 2 years ago #
On every post I get the following error:
Warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/status/wp-content/plugins/simple-tags/inc/client.php on line 1312
Warning: shuffle() expects parameter 1 to be array, null given in /var/www/status/wp-content/plugins/simple-tags/inc/client.php on line 1313
Warning: Invalid argument supplied for foreach() in /var/www/status/wp-content/plugins/simple-tags/inc/client.php on line 1314
I am using the P2 theme on version 2.9.2.
I have tried the suggested fix here: http://wordpress.org/support/topic/363536
Unfortunately it does not fix my problem.
I've also tried searching for a fix, to no avail. Please help!
http://wordpress.org/extend/plugins/simple-tags/
longjorn
Member
Posted 2 years ago #
I fixed this problem by adding an if statement, if is no array set to an array like this
/**
* Randomize an array and keep association
*
* @param array $array
* @return boolean
*/
function randomArray(&$array) {
// check if is array
if(!is_array($array)) {
$array = array();
}
// if not array set to array
$keys = array_keys($array);
shuffle($keys);
foreach($keys as $key) {
$new[$key] = $array[$key];
}
$array = $new;
return true;
}
no more errors, everything else seems to work like normal
fernandot
Member
Posted 2 years ago #
brettbum
Member
Posted 1 year ago #
Awesome Longjorn, that worked for me as well. :)