• 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/autohenter.dk/nytsite/wp-includes/category-template.php on line 176

    I tried correcting it according to:
    https://voiceofbragg.com/category/wordpress/

    But that does not solve the problem.

    You can see the error here: https://www.autohenter.dk/nytsite/

    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)

    www.ads-software.com 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.

    Thread Starter JohnSahl

    (@johnsahl)

    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 https://voiceofbragg.com/category/wordpress/ 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)

    www.ads-software.com 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:

    https://wordpress.pastebin.ca/719436

    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)

    www.ads-software.com 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.
    https://wordpress.pastebin.ca/720225

    Any other ideas ?

    For Fall Season, I changed one line:

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

    To:

    <?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.

    schawel

    (@schawel)

    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.
    thinkeatdrink.com
    is back up!

    rocketseason

    (@rocketseason)

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

    thankyou so much!

    theaussiepea

    (@theaussiepea)

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

    https://www.binh.name/2007/11/07/a-glance-at-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.