Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function delete_empty_tags(){
- $tags = get_tags( array('number' => 0,'hide_empty' => false));
- foreach ( $tags as $tag ) {
- $tag_count = $tag->count;
- if ($tag_count < 1 ){
- wp_delete_term( $tag->term_id, 'post_tag' );
- }
- }
- }
- add_action( 'wp_head', 'delete_empty_tags' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement