Support » Plugin: Fix Category Count » Issue in update_category_correct_count

  • I think the function update_category_correct_count in fix_category_count_engine.php needs the following line changed:

    from:
    $wpdb->update(‘wp_term_taxonomy’, array(‘count’=>$count), array(‘term_taxonomy_id’=>$row[‘term_id’]));

    to:

    $wpdb->update($wpdb->prefix.’term_taxonomy’, array(‘count’=>$count), array(‘term_id’=>$row[‘term_id’]));

    The 2 changes are:
    1. Pulling in the prefix for the term_taxonomy table instead of defaulting to the prefix of “wp_”
    2. The database update call should match against column ‘term_id” and not ‘term_taxonomy_id, since the input being matched is the term_id and not the term_taxonomy_id. In some databases these numbers might be the same, but they were different by 1 in mine giving me errors.

    For many people the default code might not cause errors, but they did for me.
    After I made these changes, the plugin worked great for me. Thank you.

    • This topic was modified 4 years, 3 months ago by rbay.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Issue in update_category_correct_count’ is closed to new replies.