Inventory_Presser_Taxonomies::delete_unused_terms()
The nature of inserting and deleting vehicles means terms in a few of our taxonomies will be left behind and unused. This method deletes some of them. Runs once daily in a WordPress cron job.
Return Return
(void)
Source Source
File: includes/class-taxonomies.php
public function delete_unused_terms() {
$terms = get_terms(
array(
'taxonomy' => array( 'model_year', 'make', 'model', 'style' ),
'childless' => true,
'count' => true,
'hide_empty' => false,
)
);
foreach ( $terms as $term ) {
if ( 0 === $term->count ) {
wp_delete_term( $term->term_id, $term->taxonomy );
}
}
}
Expand full source codeCollapse full source codeView on Github