Created
January 25, 2012 03:29
-
-
Save zanematthew/1674550 to your computer and use it in GitHub Desktop.
Temp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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