SQL to query categories with no childrens in WordPress

abril 2nd, 2012 Posted by mysql, php, wordpress 0 thoughts on “SQL to query categories with no childrens in WordPress”
SELECT wp_terms.name, wp_terms.term_id
FROM wp_terms
INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id
WHERE wp_term_taxonomy.taxonomy = “category”
AND wp_terms.term_id NOT
IN (
SELECT DISTINCT parent
FROM `wp_term_taxonomy`
WHERE parent <>0
)
LIMIT 0 , 30

Dejá un comentario

Tu dirección de correo electrónico no será publicada. Los campos necesarios están marcados *

Copyright © 2018 programadorfreelanceargentina.com

Programador Freelance Argentina