Support » Plugin: Category Meta plugin » [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');
    		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)
  • Really really thanks!!! It work, I was scared it was a wp bug!

    Plugin Author elebail



    Thanks a lot for the tips.
    I made a new version (1.2.2) with a fix on this point.
    Could you try it and tell me if it works ?


    the fixed version (1.2.3) has still a problem for some kind of custom taxonomy.
    I tryed using
    add_action(‘admin_init’, ‘wptm_init’);
    instead of
    add_action(‘init’, ‘wptm_init’);

    and it work better. Maybe you can add this on future release

    Plugin Author elebail



    Many thanks.
    I created a new version (1.2.4) with your fix.

    Eric Le Bail

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.