• Resolved jeromeeee

    (@jeromeeee)


    Hi!

    Thanks for this wonderful plugin. I have gone through the support forums as well as did some searches for my problem. Something related to: https://www.ads-software.com/support/topic/built-in-taxonomies-are-not-all-visible-in-custom-post-type-edit-screen/

    I have a taxonomy that has already been registered by another plugin, and I think it’d be more sensible to ride on that created taxonomy rather than registering another one again. The taxonomy appears in the list of Built-in Taxonomies in CPT UI’s Edit Post Type page, and I have it checked. However, when I try to add a new “post” of the custom post type (created by CPT UI), the taxonomy doesn’t show (as it should on the right). I have also tried checking the Categories (WP Core) and Tags (WP Core) under Built-in Taxonomies and they display fine.

    Going to the registering taxonomy code of the plugin, I see that there is no ‘public’ => false of any sort (otherwise it should no display under CPT UI’s Built-in Taxonomies, right?), and it has ‘hierarchical’ => true (if it helps).

    I am wondering what might be the cause of registering this taxonomy that doesn’t display it on CPT UI’s Add/Edit page? I am comfortable with editing the plugin’s code, so please let me know what I can try out, or if you need me to expose the code for registering the plugin’s taxonomy.

    Many thanks in advance!

    Regards,
    Jerome

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Curious what priorities are in play for registering this other taxonomy.

    Is this other plugin a custom one? or one downloaded from www.ads-software.com somewhere?

    Thread Starter jeromeeee

    (@jeromeeee)

    Thanks for your reply Michael. I really appreciate how plugin writers are prompt and dedicated to their product.

    Basically what’s happening is the the custom post type (by CPT UI) will be riding on (or needs to use) a “property-types” taxonomy created by IMPress Listings (https://www.ads-software.com/plugins/wp-listings/). So I have a hierarchical list of taxonomy items (in property-types).

    Does it make sense to recreate the same taxonomy (with CPT UI) for the custom post type?

    Thread Starter jeromeeee

    (@jeromeeee)

    I found the solution, but it appeared that I didn’t fully understand how taxonomy works, which made me go around the bush. Sharing the taxonomy would mean creating a post count in the taxonomy even though both post types are totally unrelated.

    The following should only be used if both post types are related and need to share the same taxonomy:

    add_action( 'init', 'custom_modify_taxonomy', 20 );
    function custom_modify_taxonomy() {
        // get the arguments of the already-registered taxonomy
        $property_types_args = get_taxonomy( 'property-types' ); // returns an object
    
        // make changes to the args
        // again, note that it's an object
        $property_types_args->show_admin_column = true;
    
        // re-register the taxonomy
    	register_taxonomy_for_object_type( 'property-types', 'listings' );
        register_taxonomy( 'property-types', 'listings_savedsearch', (array) $property_types_args );
    }

    Reference: https://wordpress.stackexchange.com/questions/161788/how-to-modify-a-taxonomy-thats-already-registered

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    If it works, it works, and I won’t argue. From the looks of it, the only thing that got changed was the show_admin_column detail for the property-types taxonomy from the WP-Listings plugin.

    Glad things worked out for ya.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using (Built-in) Taxonomies from another plugin’ is closed to new replies.