0

how can I get the name of the CPT having the slug of a Taxonomy? example:

$name_cpt = get_post_type_object( $slug_taxonomy );

but this returns null.

Does anyone know how to obtain it by means of the slug of the taxonomy?

5
  • Possible duplicate of How to get custom post type label and singular label from its slug? – Akshat Jun 24 '18 at 19:21
  • No @Akshat, there is the name based on the Slug of the CPT itself, my question is different. – Lenin Zapata Jun 24 '18 at 19:45
  • Hmm... But you know that taxonomy can be assigned to many post types? How exactly should it work? – Krzysiek Dróżdż Jun 24 '18 at 20:55
  • @Krzysiek Dróżdż yes!, I know the list of taxonomies, but I need the name of CPT that belongs to each Taxonomy in the list – Lenin Zapata Jun 24 '18 at 20:56
  • 1
    OK, so if the taxonomy is assigned to 3 CPTs, you want to get names for all 3 of them? – Krzysiek Dróżdż Jun 24 '18 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.