domenica 8 gennaio 2017

word press update count

UPDATE wpyn_term_taxonomy SET count = (
SELECT COUNT(*) FROM wp_term_relationships rel 
    LEFT JOIN wpyn_posts po ON (po.ID = rel.object_id) 
    WHERE 
        rel.term_taxonomy_id = wpyn_term_taxonomy.term_taxonomy_id 
        AND 
        wpyn_term_taxonomy.taxonomy NOT IN ('link_category')
        AND 
        po.post_status IN ('publish', 'future')
)

Nessun commento:

Posta un commento