Inventory_Presser_Taxonomies::populate_default_terms()
Populate our taxonomies with terms if they do not already exist
Return Return
(void)
Source Source
File: includes/class-taxonomies.php
public static function populate_default_terms() { // create the taxonomies or else our wp_insert_term calls will fail. self::register_taxonomies(); $taxonomy_data = self::taxonomy_data(); $count = count( $taxonomy_data ); for ( $i = 0; $i < $count; $i++ ) { if ( ! isset( $taxonomy_data[ $i ]['term_data'] ) ) { continue; } foreach ( $taxonomy_data[ $i ]['term_data'] as $abbr => $desc ) { $taxonomy_name = str_replace( '-', '_', $taxonomy_data[ $i ]['args']['query_var'] ?? '' ); if ( ! is_array( term_exists( $desc, $taxonomy_name ) ) ) { $term_exists = wp_insert_term( $desc, $taxonomy_name, array( 'description' => $desc, 'slug' => $abbr, ) ); } } } }
Expand full source codeCollapse full source codeView on Github