Support » Installing WordPress » WP2.3: Warning: array_key_exists() after upgrade?

  • Hi all,

    After upgrading to 2.3, I get this error:

    Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /mounted-storage/home15b/sub002/sc17483-AAWH/ on line 176

    I tried correcting it according to:

    But that does not solve the problem.

    You can see the error here:

    Any good ideas on what to do is very welcome?

    John Sahl
    Iderig fanden!

Viewing 15 replies - 1 through 15 (of 15 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Somewhere, your theme is making a call to in_category. However, it’s doing it wrong. Look through your theme for a reference to in_category.

    Thank you!

    It seems that its “Asides” thats a problem.
    In my adminsection it states:
    [Table 'U5365490.wp_2categories' doesn't exist]
    SELECT * from wp_2categories WHERE category_count > 0

    The instructions at say you you should add quotes around $category, but you also have to delete $ :

    if (array_key_exists(‘category’, $categories))

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    That doesn’t fix the actual problem, it just makes the symptom go away. That fix at voiceofbragg also breaks the in_category function.

    The problem is most likely in your theme or possibly a plugin. Look through the theme for a reference to in_category.

    Hi all,
    I have encountered the same problem after upgrading to WordPress 2.3 with the “Fallseason 1.1” theme. Following Otto42’s advice, I searched for the “in_category” function call and found it in the theme’s index.php file.
    I have pasted the “if” clause here:

    I hope this contains the problematic function call…

    Any suggestions on how to set it straight would be highly appreciated !

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Hmmm.. I think there’s a bug here. Try this:

    Look in category-template.php. Find the in_category function.

    There’s a line that looks like this:
    $categories = wp_get_object_terms($post->ID, 'category');

    Try changing it to this:
    $categories = wp_get_object_terms($post->ID, 'category', 'fields=tt_ids');

    Might not work, but it’s worth a shot.

    I have changed the “in_category” function, as Otto42 suggested (thanks !), but unfortunately it did not help.

    Any other ideas ?

    For Fall Season, I changed one line:

    <?php if ( in_category($AsideId) && !is_single() ) : ?>


    <?php if ( $AsideID != '' && in_category($AsideId) && !is_single() ) : ?>

    This cleared up the error for me. I’m not using asides, so this functionality isn’t important to me.

    It would see that WP 2.2 and previous handled a null category value passed to in_category() better than WP 2.3 does.

    I’m using Fall Season, too. Which file is that line in?

    @stormerider, your solution resolved the issue for me too in the template MistyLook. Thanks.

    @robdircks, the code stormerider referred to was in the Main Index Template, index.php, in my template.

    Stormrider’s fix also worked for the theme TerraFirma. Thank you for taking the time to share — you saved me a lot of trouble.

    @stormerider, your solutions works for me. Thanks.

    I was using Mistylook as a theme. I just went into my themes dir which is located in the WP Content dir. I located the index.php file. I copied StormRider’s fix and walah. It’s fixed.

    For others. Don’t modify your orginal WP code. The issues are in the themes usually. This is my third fix like this.
    is back up!

    stormriders solution seems to be the least destructive fix for this issue.

    thankyou so much!

    There is a very similar fix documented here, for the JustSimple WordPress Theme:

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘WP2.3: Warning: array_key_exists() after upgrade?’ is closed to new replies.