[Plugin: Category Meta plugin] Custom Taxonomies Fix for WP 3.0
-
There’s an issue with custom taxonomies not working for this plug-in if the taxonomies are registered elsewhere on an action-hook, as opposed to immediately upon code inclusion. I’ve found the fix, and included it below:
Line 69 of wp-category-meta.php:
add_action('admin_init', 'wptm_admin_init'); function wptm_admin_init(){ global $wp_version; if($wp_version >= '3.0') { add_action('created_term', 'wptm_save_meta_tags'); add_action('edit_term', 'wptm_save_meta_tags'); add_action('delete_term', 'wptm_delete_meta_tags'); $wptm_taxonomies=get_taxonomies('','names'); if (is_array($wptm_taxonomies) ) { foreach ($wptm_taxonomies as $wptm_taxonomy ) { add_action($wptm_taxonomy . '_add_form_fields', 'wptm_add_meta_textinput'); add_action($wptm_taxonomy . '_edit_form', 'wptm_add_meta_textinput'); } } } else { add_action('create_category', 'wptm_save_meta_tags'); add_action('edit_category', 'wptm_save_meta_tags'); add_action('delete_category', 'wptm_delete_meta_tags'); add_action('edit_category_form', 'wptm_add_meta_textinput'); } }
As explanation, the
get_taxonomies('','names');
function returns nothing if it’s called before the taxonomies are registered. As none of the functions for adding the fields to admin are needed elsewhere, they’re now called by the ‘admin_init’ action hook.Hope that helps someone!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘[Plugin: Category Meta plugin] Custom Taxonomies Fix for WP 3.0’ is closed to new replies.