WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Warning: array_key_exists() (9 posts)

  1. BLT-FQX
    Member
    Posted 6 years ago #

    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.

  2. BLT-FQX
    Member
    Posted 6 years ago #

    Upgraded the theme and solved.

  3. voiceofbragg
    Member
    Posted 6 years ago #

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

  4. bmediaventures
    Member
    Posted 6 years ago #

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

  5. flammable
    Member
    Posted 6 years ago #

    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.

  6. flammable
    Member
    Posted 6 years ago #

    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.

  7. Texoor
    Member
    Posted 6 years ago #

  8. sky7998
    Member
    Posted 6 years ago #

    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.

  9. flammable
    Member
    Posted 6 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic