Skip to content

Instantly share code, notes, and snippets.

@zanematthew
Created January 25, 2012 03:29
Show Gist options
  • Save zanematthew/1674550 to your computer and use it in GitHub Desktop.
Save zanematthew/1674550 to your computer and use it in GitHub Desktop.
Temp
<?php
// Sample data
$taxonomies = array(
'editorial' => array(
'book',
'magazines',
'new',
'newspaper',
'website',
'weddings'
),
'retail' => array(
'fine-art',
'prints',
'greeting cards',
'posters',
'school portraits',
'senior portraits',
't-shirts',
'weddings'
),
'commercial' => array(
'annual reports',
'billboards',
'brochures',
'print advertising',
'product packaging',
'public relations',
'web advertising',
'websites'
)
);
foreach ( $taxonomies as $taxonomy => $terms ) {
$r_taxonomy = $wpdb->insert( $wpdb->prefix . 'wp_media_cart_license_taxonomies', array( 'license_type_name' => $taxonomy ), '%s' );
// Set to false to avoid fatal error "add_rewrite_tag on a non-object"
register_taxonomy( $taxonomy, 'attachment', array( 'rewrite' => false ) );
for ( $i=0, $count=count( $terms ); $i < $count; $i++ ) {
$r_term = wp_insert_term( $terms[$i], $taxonomy );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment