• Resolved jordisan

    (@jordisan)


    It’s not working with custom taxonomies defined with plugin “Types”, WordPress 4.2.2

    I think it’s because it’s calling get_taxonomies in initialize() before custom ones are registered.

    WORKAROUND: calling get_taxonomies again in admin_init():

    public function admin_init()
    	{
    		// call this here to get custom taxonomies
    		$this->taxonomies = get_taxonomies();
    
    		if( ! is_array( $this->taxonomies) ) return;
    
    		foreach( $this->taxonomies as $taxonomy )
    		{
    			add_action( $taxonomy . '_add_form_fields'  , array($this,'add_taxonomy_field')  );
    			add_action( $taxonomy . '_edit_form_fields' , array($this,'edit_taxonomy_field') );
    		}
    	}

    https://www.ads-software.com/plugins/wpcustom-category-image/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Problem solved with this solution. thanks jordisan.

    Plugin Author E.

    (@pyro3x)

    Fixed. Thanks @irandoust.

    @jordisan – Please update WP Custom Category.

    replaced the admin_init() function in WPCustomCategoryImage.php in plugin’s directory with following and it worked for me. now its showing all images form other categories rather then only form uncategorized categories in posts

    ` public function admin_init()
    {
    $this->taxonomies = get_taxonomies();

    add_filter(‘manage_edit-category_columns’, array($this, ‘manage_category_columns’));
    add_filter(‘manage_category_custom_column’, array($this, ‘manage_category_columns_fields’), 10, 3);

    foreach ((array) $this->taxonomies as $taxonomy) {
    $this->add_custom_column_fields($taxonomy);
    }

    // call this here to get custom taxonomies
    $this->taxonomies = get_taxonomies();

    if( ! is_array( $this->taxonomies) ) return;

    foreach( $this->taxonomies as $taxonomy )
    {
    add_action( $taxonomy . ‘_add_form_fields’ , array($this,’add_taxonomy_field’) );
    add_action( $taxonomy . ‘_edit_form_fields’ , array($this,’edit_taxonomy_field’) );
    }

    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Not working with custom taxonomies (plugin "Types" WP 4.2)’ is closed to new replies.