Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I tagged a blog post as an article by adding the custom field ‘article’. The original blog post was posted in the categories ‘UK’ (ID=32) and ‘Humour’ (ID=43).

    The Articles page was displayed and included the blog post. However, the categories associated with the blog post were incorrectly displayed on the articles pages as ‘Gadget’ (ID=31) and ‘Podcast’ (ID=42) in my case.

    I am running WP 2.3, no tags just categories. I had a stray link category that meant my term ID’s didn’t exactly match the taxonomy ID’s.

    After a little digging, I think the join to find the categories may be incorrect. Here is a patch that fixed it for me.

    Don’t bother telling me this isn’t pure mySQL syntax. I work for Oracle and that’s the way I write my SQL joins ??

    Hope this helps.

    $ diff articles.php.orig articles.php
    99,104c99,102
    < FROM $wpdb->term_relationships
    < LEFT JOIN $wpdb->terms
    < ON $wpdb->term_relationships.term_taxonomy_id = $wpdb->terms.term_id
    < LEFT JOIN $wpdb->term_taxonomy
    < ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id
    < WHERE $wpdb->term_relationships.object_id IN (“.implode(‘,’, $post_ids).”)

    > FROM $wpdb->term_relationships, $wpdb->terms, $wpdb->term_taxonomy
    > WHERE $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id
    > AND $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id
    > AND $wpdb->term_relationships.object_id IN (“.implode(‘,’, $post_ids).”)

Viewing 2 replies - 1 through 2 (of 2 total)