WordPress.org

Ready to get started?Download WordPress

Forums

CPT-onomies: Using Custom Post Types as Taxonomies
[resolved] Taxonomy admin boxes defaulting to autocomplete box not checklist (9 posts)

  1. JuniperPaul
    Member
    Posted 1 year ago #

    Hi Rachel,

    Thanks for your very promising plugin!

    I created post types, then installed your plugin, then assigned relationships, however I'm finding that when I edit a CPT post I'm seeing autocomplete boxes, not checklists. Is the latter no longer your default?

    I'll add your custom filter code but am wondering where the glitch is occurring - something I've done? something you've done? documentation needs updating? - and if there's a way to correct it in the admin interface without having to add custom code.

    Thanks,
    Paul

    http://wordpress.org/extend/plugins/cpt-onomies/

  2. Rachel Carden
    Member
    Plugin Author

    Posted 1 year ago #

    Originally, the only choice offered was the checklist. With a regular WordPress taxonomy, you get the checklist if your taxonomy is hierarchical and the autocomplete box if your taxonomy is non-hierarchical.

    In version 1.1, I added support for the autocomplete box and, in keeping with WP functionality, set it up so that you see the autocomplete if your CPT-onomy is non-hierarchical and the checklist if your CPT-onomy is hierarchical.

    At this point in time, the only way to change this default behavior is to hook into the plugin via the 'custom_post_type_onomies_meta_box_format' filter. I have not ruled out adding this property to the settings but, for now, the filter is the cleanest way to adjust default plugin behavior since the filter allows you to easily designate format for multiple combinations of post type and CPT-onomy.

    If you think there is a bug, please include your code and I will look into it.

    Thanks!

  3. JuniperPaul
    Member
    Posted 1 year ago #

    My custom post types were set to hierarchical but I wasn't getting checkboxes. Am I missing something? I don't see any other place within the admin UI to set a hierarchical attribute on any object.

    Cheers,
    Paul

  4. Rachel Carden
    Member
    Plugin Author

    Posted 1 year ago #

    Hmm. Can you include a screenshot of your settings? and of the edit CPT screen?

  5. JuniperPaul
    Member
    Posted 1 year ago #

    Here are some screenshots that illustrate my situation. The problem occurs with all of the post type relationships I've created, but here I'll illustrate with Merchants assigned as a taxonomy in the Artisans post:

    When I add filter code to my functions script returning 'checklist' when the post type name is one of my CPTs, the problem with the checklist goes away:

    add_filter( 'custom_post_type_onomies_meta_box_format', 'artsquest_custom_post_type_onomies_meta_box_format', 1, 3 );
    
    function artsquest_custom_post_type_onomies_meta_box_format( $format, $taxonomy, $post_type )
    {
    	switch ($post_type)
    	{
    		case 'aq_merchant':
    		case 'aq_artisan':
    		case 'tcp_product':
    		case 'aq_curator':
    			$format = 'checklist';
    		break;
    	}
    
    	// WordPress filters must always return a value
    	return $format;
    }

    Let me know if you need to see more.

    Thanks,
    Paul

  6. JuniperPaul
    Member
    Posted 1 year ago #

    PS: Of course it's worth noting that the post type editor I'm using here is part of the TheCartPress plugin. The custom post types it creates appear to be solid in all other respects.

    I did try creating a minimal Test post type using your plugin but that resulted in a cascade of PHP errors starting with "Warning: trim() expects parameter 1 to be string, array given in [...]/wp-content/plugins/cpt-onomies/admin-settings.php on line 290" on a line referring to $cpt[ 'capability_type' ]. At this point I assume that the script was expecting me to fill in a field I'd left blank; I'll explore that anon.

    A plugin conflict is a possibility but I'm hoping it's resolvable as I'd very much like to use both TheCartPress and CPT-onomies.

    Cheers,
    Paul

  7. Rachel Carden
    Member
    Plugin Author

    Posted 1 year ago #

    Just to double check, I know it's set to "hierarchical" but are you 100% sure the "merchants" post type is actually hierarchical?

    I'll be looking at my code to see if its a bug on my end.

  8. adige72
    Member
    Posted 1 year ago #

    Is there any way to get autocomplete for hierarchical taxonomies?

  9. Rachel Carden
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, there is: Assigning CPT-onomy Terms

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic