[wp-hackers] wp_list_categories()

Mike Schinkel mikeschinkel at gmail.com
Fri Jan 2 13:13:10 GMT 2009


Daiv:

My next question is, is it fair to say these are your two SQL queries?
(They execute on my v2.7 test install):

SELECT
 wp_term_taxonomy.count as 'count',
 wp_terms.term_id,
 wp_terms.name,
 wp_terms.slug,
 wp_term_taxonomy.parent,
 wp_term_taxonomy.description
FROM
 wp_terms,  wp_term_taxonomy
WHERE
 wp_terms.term_id = wp_term_taxonomy.term_id AND
 wp_terms.name != 'Blogroll' AND
 wp_term_taxonomy.taxonomy = 'category'
ORDER BY
 wp_terms.name

SELECT  wp_terms.term_id,
 wp_terms.name,
 wp_terms.slug,
 wp_term_taxonomy.count,
 wp_posts.id,
 wp_posts.post_title,
 wp_posts.post_name,
 date(wp_posts.post_date) as 'date'
FROM
 wp_posts,
 wp_terms,
 wp_term_taxonomy,
 wp_term_relationships
WHERE
 wp_posts.id = wp_term_relationships.object_id AND
 wp_posts.post_status='publish' AND
 wp_terms.term_id = wp_term_taxonomy.term_id AND
 wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND
 wp_term_taxonomy.taxonomy = 'category'

-Mike Schinkel
http://mikeschinkel.com


More information about the wp-hackers mailing list