$12
Custom taxonomies break media insert dialog
add_action( 'init', 'create_workshops_taxonomies', 0 );
function create_workshops_taxonomies()
{
// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
'name' => _x( 'Workshop Venues', 'taxonomy general name' ),
'singular_name' => _x( 'Venue', 'taxonomy singular name' ),
'search_items' => __( 'Search Venues' ),
'all_items' => __( 'All Venues' ),
'parent_item' => __( 'Parent Venues' ),
'parent_item_colon' => __( 'Parent Venue:' ),
'edit_item' => __( 'Edit Venue' ),
'update_item' => __( 'Update Venue' ),
'add_new_item' => __( 'Add New Venue' ),
'new_item_name' => __( 'New Venue Name' ),
);
register_taxonomy('venue',array('workshops'),
array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'venue' ),
));
$labels = array(
'name' => _x( 'Workshop Types', 'taxonomy general name' ),
'singular_name' => _x( 'Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Types' ),
'all_items' => __( 'All Types' ),
'parent_item' => __( 'Parent Types' ),
'parent_item_colon' => __( 'Parent Type:' ),
'edit_item' => __( 'Edit Type' ),
'update_item' => __( 'Update Type' ),
'add_new_item' => __( 'Add New Type' ),
'new_item_name' => __( 'New Type Name' ),
);
register_taxonomy('type',array('workshops'),
array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'type' ),
));
$labels = array(
'name' => _x( 'Workshop Times', 'taxonomy general name' ),
'singular_name' => _x( 'Time', 'taxonomy singular name' ),
'search_items' => __( 'Search Times' ),
'all_items' => __( 'All Times' ),
'parent_item' => __( 'Parent Times' ),
'parent_item_colon' => __( 'Parent Time:' ),
'edit_item' => __( 'Edit Time' ),
'update_item' => __( 'Update Time' ),
'add_new_item' => __( 'Add New Time' ),
'new_item_name' => __( 'New Time Name' ),
);
register_taxonomy('time',array('workshops'),
array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'time' ),
));
$labels = array(
'name' => _x( 'Workshop Status', 'taxonomy general name' ),
'singular_name' => _x( 'Status', 'taxonomy singular name' ),
'search_items' => __( 'Search Status' ),
'all_items' => __( 'All Status' ),
'parent_item' => __( 'Parent Status' ),
'parent_item_colon' => __( 'Parent Status:' ),
'edit_item' => __( 'Edit Status' ),
'update_item' => __( 'Update Status' ),
'add_new_item' => __( 'Add New Status' ),
'new_item_name' => __( 'New Status Name' ),
);
register_taxonomy('status',array('workshops'),
array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'status' ),
));
}
James Beardmore | 07/28/10 at 11:22am
| Edit
(2) Possible Answers Submitted...
-

Last edited:
07/28/10
11:47amMilan Petrovic says:You must not set priority for this init action to 0, or you might initialize your taxonomies (and custom post types) before WP defaults. I am author of GD Custom Posts and Taxonomies Tools plugin, and I use priority 1 for custom post types, and 2 for taxonomies to avoid WP conflicts.
So use this:
add_action( 'init', 'create_workshops_taxonomies', 2 );
And taxonomies should be added when they don't cause problems. Most likely your upload problems are caused by that. Also, I didn't check your full code, it too long, but my guess is this. And I recommend that you try my plugin and avoid problems with adding this bulky code to functions.php.- 07/28/10 11:53am
James Beardmore says:Nope that didn't do it. I'll definitely take a look at the plugin, I've heard lots of good things about it. However I still want to solve this for my own education.
- 07/28/10 11:53am
James Beardmore says:Nope that didn't do it. I'll definitely take a look at the plugin, I've heard lots of good things about it. However I still want to solve this for my own education.
- 07/28/10 11:53am
-

Last edited:
07/28/10
11:59amwjm says:
I assume you are using the custom post types "workshops"
if not, you are doing something wrong.
It has to do with this line
register_taxonomy('type',array('post'),
you are using a reserved word (type)
change it to something else, something like workshop_type
register_taxonomy('workshop_type',array('post'),
it should work
let me know if it doesnt.
- wjm
- 07/28/10 11:56am
wjm says:sorry, it should be
register_taxonomy('workshop_type',array('workshops'),
i changed workshops for post for testing it. - 07/28/10 1:50pm
James Beardmore says:Turns out I was mistaken, that didnt fix my problem, in fact, it broke the entire site! Looking at various tutorials including the WP codex, its clear that it was correct in having
register_taxonomy('type',array('workshops'),
And not
register_taxonomy('type',array('workshops'),
It turned out that the actual problem was from using "type" as a taxonomy term. Its obviously used somewhere else in the WP core and was ocnflicting with the media uploader. I changed it and now all is well. - 07/28/10 1:51pm
James Beardmore says:Sorry meant to say that it is supposed to be
register_taxonomy('type',array('workshops'),
and not
register_taxonomy('workshop_type',array('workshops'),
- 07/28/10 11:56am
This question has expired.
Current status of this question: Completed





