Inventory_Presser_Taxonomies::register_taxonomies()
Registers all our custom taxonomies
Return Return
(void)
Source Source
File: includes/class-taxonomies.php
public static function register_taxonomies() {
// Get the huge array of taxonomy data.
$taxonomy_data = self::taxonomy_data();
// Get the plugin settings where some taxonomies may be disabled.
$settings = INVP::settings();
$count = count( $taxonomy_data );
for ( $i = 0; $i < $count; $i++ ) {
// If the taxonomy is disabled in the settings, skip it.
if ( ! isset( $settings['taxonomies'][ $taxonomy_data[ $i ]['args']['query_var'] ]['active'] )
|| ! $settings['taxonomies'][ $taxonomy_data[ $i ]['args']['query_var'] ]['active'] ) {
continue;
}
// Replace hyphens with underscores.
$taxonomy_name = str_replace( '-', '_', $taxonomy_data[ $i ]['args']['query_var'] ?? '' );
register_taxonomy( $taxonomy_name, INVP::POST_TYPE, $taxonomy_data[ $i ]['args'] );
}
}
Expand full source codeCollapse full source codeView on Github