Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tag_to_category ($post_id = 0) {
- if (!$post_id) return;
- $post_tags = get_the_tags($post_id);
- foreach ($post_tags as $tag) {
- $cat_id = wp_create_category($tag->name);
- $result = wp_set_post_terms( $post_id, $cat_id, 'category', true );
- }
- }
- add_action('save_post','tag_to_category');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement