WordPress.org

Ready to get started?Download WordPress

Forums

WP2.3: Warning: array_key_exists() after upgrade? (16 posts)

  1. JohnSahl
    Member
    Posted 6 years ago #

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

    But that does not solve the problem.

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

    Any good ideas on what to do is very welcome?

    --
    John Sahl
    Iderig fanden!

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  3. JohnSahl
    Member
    Posted 6 years ago #

    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

  4. sifaan
    Member
    Posted 6 years ago #

    The instructions at http://voiceofbragg.com/category/wordpress/ say you you should add quotes around $category, but you also have to delete $ :

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

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  6. tomsing1
    Member
    Posted 6 years ago #

    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:

    http://wordpress.pastebin.ca/719436

    I hope this contains the problematic function call...

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

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  8. tomsing1
    Member
    Posted 6 years ago #

    I have changed the "in_category" function, as Otto42 suggested (thanks !), but unfortunately it did not help.
    http://wordpress.pastebin.ca/720225

    Any other ideas ?

  9. stormerider
    Member
    Posted 6 years ago #

    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.

  10. RobDircks
    Member
    Posted 6 years ago #

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

  11. CaptQuirk
    Member
    Posted 6 years ago #

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

  12. jalancast
    Member
    Posted 6 years ago #

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

  13. atanone
    Member
    Posted 6 years ago #

    @stormerider, your solutions works for me. Thanks.

  14. schawel
    Member
    Posted 6 years ago #

    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!

  15. RocketSeason
    Member
    Posted 6 years ago #

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

    thankyou so much!

  16. creativecoder
    Member
    Posted 6 years ago #

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

    http://www.binh.name/2007/11/07/a-glance-at-justsimple-wordpress-theme/

Topic Closed

This topic has been closed to new replies.

About this Topic