WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I call get_post_types() in a plugin the output is registering only the basic set of post types. Here is the output:

array(5) { ["post"]=> string(4) "post" ["page"]=> string(4) "page" ["attachment"]=> string(10) "attachment" ["revision"]=> string(8) "revision" ["nav_menu_item"]=> string(13) "nav_menu_item" }

In this wordpress theme, however, I have registered a custom post type called 'artist', but it is not showing up. If, however, I call get_post_types() in the index.php file it does how the registered posts:

array(8) { ["post"]=> string(4) "post" ["page"]=> string(4) "page" ["attachment"]=> string(10) "attachment" ["revision"]=> string(8) "revision" ["nav_menu_item"]=> string(13) "nav_menu_item" ["acf"]=> string(3) "acf" ["artist"]=> string(6) "artist" ["release"]=> string(7) "release" }

Does anyone know why this is happening and how to get around the problem?

share|improve this question
Where and when do you call get_post_types()? – kaiser May 22 '13 at 23:40
up vote 1 down vote accepted

You have to wait with your call until the theme has registered its post type (it really should not do that anyway):

add_action( 'after_setup_theme', 'list_post_types', 20 );

function list_post_types()
    var_export( get_post_types() );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.