Pressbooks\Taxonomy::upgradeChapterTypes PHP Method

upgradeChapterTypes() public method

Upgrade Chapter Types.
public upgradeChapterTypes ( )
    function upgradeChapterTypes()
    {
        $type_1 = get_term_by('slug', 'type-1', 'chapter-type');
        $type_2 = get_term_by('slug', 'type-2', 'chapter-type');
        $type_3 = get_term_by('slug', 'type-3', 'chapter-type');
        $type_4 = get_term_by('slug', 'type-4', 'chapter-type');
        $type_5 = get_term_by('slug', 'type-5', 'chapter-type');
        if ($type_1) {
            wp_update_term($type_1->term_id, 'chapter-type', array('name' => 'Standard', 'slug' => 'standard'));
        }
        if ($type_2) {
            wp_delete_term($type_2->term_id, 'chapter-type');
        }
        if ($type_3) {
            wp_delete_term($type_3->term_id, 'chapter-type');
        }
        if ($type_4) {
            wp_delete_term($type_4->term_id, 'chapter-type');
        }
        if ($type_5) {
            wp_delete_term($type_5->term_id, 'chapter-type');
        }
    }