Inventory_Presser_Taxonomies::populate_default_terms()
populate_default_terms
Contents
Description Description
Populate our taxonomies with terms if they do not already exist
Return Return
(void)
Source Source
File: includes/class-taxonomies.php
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(); for ( $i = 0; $i < sizeof( $taxonomy_data ); $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 code Collapse full source code View on Github