WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Simple Tags] Autolink still not working with 2.9.2 (4 posts)

  1. cardnaul
    Member
    Posted 4 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/

  2. longjorn
    Member
    Posted 4 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

  3. Fernandot
    Member
    Posted 4 years ago #

    Works great!

    Thanks!

  4. brettbum
    Member
    Posted 4 years ago #

    Awesome Longjorn, that worked for me as well. :)

Topic Closed

This topic has been closed to new replies.

About this Topic