WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Install::create_terms() public WC 1.0

Add the default terms for WC taxonomies - product types and order statuses. Modify this at your own risk.

{} Это метод класса: WC_Install{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$result = WC_Install::create_terms();

Код WC_Install::create_terms() WC 5.6.0

public static function create_terms() {
	$taxonomies = array(
		'product_type'       => array(
			'simple',
			'grouped',
			'variable',
			'external',
		),
		'product_visibility' => array(
			'exclude-from-search',
			'exclude-from-catalog',
			'featured',
			'outofstock',
			'rated-1',
			'rated-2',
			'rated-3',
			'rated-4',
			'rated-5',
		),
	);

	foreach ( $taxonomies as $taxonomy => $terms ) {
		foreach ( $terms as $term ) {
			if ( ! get_term_by( 'name', $term, $taxonomy ) ) { // @codingStandardsIgnoreLine.
				wp_insert_term( $term, $taxonomy );
			}
		}
	}

	$woocommerce_default_category = (int) get_option( 'default_product_cat', 0 );

	if ( ! $woocommerce_default_category || ! term_exists( $woocommerce_default_category, 'product_cat' ) ) {
		$default_product_cat_id   = 0;
		$default_product_cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug', 'woocommerce' ) );
		$default_product_cat      = get_term_by( 'slug', $default_product_cat_slug, 'product_cat' ); // @codingStandardsIgnoreLine.

		if ( $default_product_cat ) {
			$default_product_cat_id = absint( $default_product_cat->term_taxonomy_id );
		} else {
			$result = wp_insert_term( _x( 'Uncategorized', 'Default category slug', 'woocommerce' ), 'product_cat', array( 'slug' => $default_product_cat_slug ) );

			if ( ! is_wp_error( $result ) && ! empty( $result['term_taxonomy_id'] ) ) {
				$default_product_cat_id = absint( $result['term_taxonomy_id'] );
			}
		}

		if ( $default_product_cat_id ) {
			update_option( 'default_product_cat', $default_product_cat_id );
		}
	}
}