Fixing the array_key_exists WordPress Warning/Error – The first argument should be either a string or an integer in


Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /your-sitepath/wp-includes/category-template.php on line 176

This problems stems from line 176 as stated above – some people have said that updating their wordpress theme worked, however, a simple change to line 176 seems to work perfectly.

Change line 176 from:

if(array_key_exists($category, $categories))

To

if(array_key_exists('$category', $categories))

Don’t see the difference? Just add single quotes around the first $category variable. Make sure they are not the curly single quotes.

5 thoughts on “Fixing the array_key_exists WordPress Warning/Error – The first argument should be either a string or an integer in”

  1. Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language 😉
    See you!
    Your, Raiul Baztepo

Leave a Reply

Your email address will not be published. Required fields are marked *