I'm writing a small plugin for Visual Composer. I need to list all custom post types but I don't know when to call the query to fetch all post types. My plugin gets initialized by
after_setup_theme, but the function which queries the custom post types don't list custom post types, because its executed too early.
The problem: custom post types can be created within theme files (e.g.
function.php) or plugins (like
Custom Post Type UI).
Which action should I use to get all custom post types? I know that Advanced Custom Fields does the same (you can create custom fields for every (custom) post type), but I can't find the piece of code that does the trick.