Make WordPress Core

Ticket #14485: test-term-cache.php

File test-term-cache.php, 528 bytes (added by scribu, 14 years ago)

Corrected

Line 
1<?php
2
3function test_term_cache() {
4        wp_delete_term(get_term_by('name', 'Parent', 'category')->term_id, 'category');
5        wp_delete_term(get_term_by('name', 'Child', 'category')->term_id, 'category');
6
7        $parent = wp_insert_term('Parent', 'category');
8        $parent_id = $parent['term_id'];
9
10        $child = wp_insert_term('Child', 'category', array('parent' => $parent_id));
11        $child_id = $child['term_id'];
12
13        echo '<pre>';
14        print_r(get_term_children($parent_id, 'category'));
15        echo '</pre>';
16}
17
18add_action('admin_notices', 'test_term_cache');