• Resolved mgoerls

    (@mgoerls)


    Hi.
    I want to use get_post_types() to retrieve only the post types registered with the “Custom Post Type UI” plugin. How can I filter to get only these post types?
    -Lutz

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

    (@tw2113)

    The BenchPresser

    Hi,

    I guess it depends on what you’re trying to do. If you are fine with just the names/slugs only, we have cptui_get_post_type_slugs() available via the plugin itself. However, that’ll just be an array of the slugs.

    If you’re needing WP_Post_Type objects where you can check on the registered properties/arguments/etc, then I don’t really have a great answer offhand.

    Closest idea I can think of off the top of my head would be use get_post_types() in conjunction with cptui_get_post_type_slugs() and use the latter to filter down the results from the first one to a final result.

Viewing 1 replies (of 1 total)
  • The topic ‘get_post_types() => post types of the plugin only’ is closed to new replies.