Forum Replies Created

Viewing 1 replies (of 1 total)
  • This is apparently the fix:

    This is the original code:

    —————————————————————
    function in_category( $category ) { // Check if the current post is in the given category
    global $post, $blog_id;

    $categories = get_object_term_cache($post->ID, ‘category’);
    if ( false === $categories )
    $categories = wp_get_object_terms($post->ID, ‘category’);
    if(array_key_exists($category, $categories))
    return true;
    else
    return false;
    }
    ——————————————————
    This is the fix:
    ———————————————————-
    function in_category( $category ) { // Check if the current post is in the given category
    global $post, $blog_id;

    $categories = get_object_term_cache($post->ID, ‘category’);
    if ( false == $categories )
    $categories = wp_get_object_terms($post->ID, ‘category’);
    if(array_key_exists(‘category’, $categories))
    return true;
    else
    return false;
    }
    ———————————————————-
    Notice the === signs. I changed that to ==

    I also changed $category to ‘category’
    ———————————————————-
    See if that works for you. I am no longer getting the error message, but let’s see if that fixews the problem for everybody

Viewing 1 replies (of 1 total)