It is not possible to output the registered record types related to the registered taxonomy.

I do this:

$args = array ( 'taxonomies' => array('cat_inst') ); print_r(get_post_types($args)); 

Displays an empty array. Taxonomy and record type customs. Tell me, please, what could be the nuance?

My main question is how to find out what types of records taxonomy has?

    1 answer 1

    You can get registered record types related to a registered taxonomy as follows:

     global $wp_taxonomies; var_dump($wp_taxonomies['product_cat']->object_type); 

    An array of registered types will be displayed. For WooCommerce, as in the example above,

     Array[1] 0: "product" 

    As an inverse problem, all taxonomies related to the record type can be inferred using the following function:

     get_object_taxonomies('product'); 

    For the product taxonomy in WooCommerce, we get the following result:

     Array[5] 0: "product_type" 1: "product_cat" 2: "product_tag" 3: "product_shipping_class" 4: "pa_color" 
    • This function gets a list of taxonomies related to the type of post, post, etc. And I need a list of post types in taxonomy. - Valentin Dranyy
    • You have put the question: "registered record types related to the registered taxonomy". I answered that way. Give a specific example, otherwise it is difficult to understand what you want. - KAGG Design
    • You all mixed up the type of post you have a product, and you derived taxonomies attached to this type. - Valentin Dranyy
    • Completed the answer. - KAGG Design
    • It works, thanks. Why is it impossible with get_post_types ()? - Valentin Dranyy