Category Meta plugin
Custom Taxonomies Fix for WP 3.0 (5 posts)

  1. Jacob Dunn
    Posted 5 years ago #

    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!

  2. webgrafia
    Posted 5 years ago #

    Really really thanks!!! It work, I was scared it was a wp bug!

  3. elebail
    Plugin Author

    Posted 5 years ago #


    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 ?


  4. webgrafia
    Posted 5 years ago #

    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

  5. elebail
    Plugin Author

    Posted 5 years ago #


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

    Eric Le Bail

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Category Meta plugin
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic