Support » Alpha/Beta/RC » Warning: array_key_exists()

  • Resolved BLT-FQX

    (@blt-fqx)


    After I upgrade from 2.2.2 to 2.3-b1, the following message appears above each post of my blog.

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

    And in line 168
    if(array_key_exists($category, $categories))

    I searched but found nothing.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Upgraded the theme and solved.

    Go to voiceofbragg.com to see how I fixed it.

    What do you mean by upgraded theme? i’m having the same problem on blastmagazine.com

    Having the same issue (upgraded a test install). Switched back to Kubrick, the default theme, which didn’t show the same problems – and turned off all of my plugins, so it can’t be them.

    As I’ve narrowed it down to my theme, is there a place I should be looking to figure out how to fix this? I don’t want to modify WP core code, but that’s where the error leads to.

    Okay, I don’t know if this will do it for everyone…but it seems that my theme has some extra features that I don’t use, and one of them was causing these issues. I’m using the 3-column Relaxation theme.

    It required me to alter the loop a bit from the theme’s version…here’s the before:

    <?php if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>
    <?php if ( !(in_category(get_settings('3cr_v1_asides_cats_to_exclude_from_blog'))) ) { ?>
    
    <div class="post">
    <h1 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
    <p class="date"><?php the_time('F jS, Y') ?> by <?php the_author('namefl'); ?>
    
    <div class="entry">
    <?php the_content('[more...]'); ?>
    </div>
    
    <!--
    <?php trackback_rdf(); ?>
    -->
    <?php if(!is_single() && ($post==$posts[get_settings('3cr_v1_google_contentarea_adsense_code_pos1')] OR $post==$posts[get_settings('three_column_relax_v1_google_contentarea_adsense_code_pos2')])) { ?>
    <?php echo stripslashes(get_settings('3cr_v1_v1_google_contentarea_adsense_code')); ?>
    
    <?php } ?>
    </div>
    <?php }; ?>
    <?php endwhile; ?>

    to:

    <?php if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    <div class="post">
    <h1 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
    <p class="date"><?php the_time('F jS, Y') ?> by <?php the_author('namefl'); ?>
    
    <div class="entry">
    <?php the_content('[more...]'); ?>
    </div>
    </div>
    <?php endwhile; ?>

    I know it probably won’t fix it for everyone (if anyone else), but hopefully it’ll help some people track down the problem for themselves.

    I’m considering installing the 2.5 Beta on site of small dogs in a ‘beta’ folder for further testing, alongside the current 2.3.3 install. (so if 2.3.3 is under “blog” then 2.5 would be installed under “blog-beta” to keep it separate). They’d be running off of the same wordpress database and would use the same folder for uploads to keep images in sync.

    sky7998, I think you might have replied to the wrong topic. 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Warning: array_key_exists()’ is closed to new replies.