20 Responses

  1. Tiyo Kamtiyono
    Tiyo Kamtiyono Published |

    This is a handy snippet to have Justin, post type is now the ring and bells of WordPress. I just wonder why Hybrid not (yet) include this kind of type on the post meta section by default.

    I found this on Thematic when I already creating a ‘series’ of post using your plugin, and the series meta is included, I never know it before, Thematic was nice by that 🙂

    Sorry if I have a misunderstanding, series is one of the type, right? ;(

  2. Lucy Beer
    Lucy Beer Published |

    Thanks for this. I found the level of detail you included really helpful in gaining a more in-depth understanding of custom post types.

    1. Damien
      Damien Published |

      I agree! The comments in this are fantastic and really helped!

  3. Marc
    Marc Published |

    Thanks for saving me time!

  4. Extremely thorough cheat sheet on register_post_type() by @justintadlock - Advanced WordPress Tutorials, Tips and Resources
  5. Wasifaliwasi
    Wasifaliwasi Published |

    This post have a great article . Nice information for everyone .Thanks for this post .

  6. Ansif
    Ansif Published |

    Great Cheat-sheet for Custom Post Type :

    I have one question that you have mentioned in this code as :


    What it does in our post type?

  7. lesterine
    lesterine Published |

    hi justin,

    thank you for all your work and posting on wordpress. quite frankly, i’m not sure what i find more inspiring ~ your homesteading / gardening / cooking and baking . . . or coding. for i, too, am a friend of plants and delicious home cooked meals 🙂

    to my point:

    will you be adding to this post or penning a new one on adding custom fields, including displaying on the edit screen for custom post types?

    i am currently having trouble displaying the custom fields on my hand-coded custom post type, using “add_meta_box” and other functions.

    i’m using an outdated book from sitepoint (which i whole-heartedly recommend for beginners) but can’t get those pesky fields to show up on the admin edit custom post page ~ darn it!!

    of course, i will continue to google around . . . and, thank you, hard-coded, kind-hearted sir!

  8. Asraful
    Asraful Published |

    This code is very useful for me because it depicts line by line.Thanks

  9. Craig Grella
    Craig Grella Published |


    regarding the init action hook, when registering a custom post type are there any suggestions for tracking down the order in which the custom post type should fire.

    I’m using facetwp on a site, and it pulls in drop downs of all custom post types listed on the site, except some of my custom post types. I’m wondering if the facetwp plugin code is firing before my custom post types and thinking that may be causing it to be missing from facetwp’s drop down of custom post types available on my list.

    I’m thinking i need to register that post type before facetwp fires its code, but not sure even how to track that down.



  10. nathan
    nathan Published |

    thank you for this Justin, this helped me over 9000! One small suggestion, update your older post on WordPress roles/capabilities to use the default capabilities you’ve provided in this snippet! 🙂

  11. Clone role capabilities for a post type - HelpDesk
  12. oorlandoni
    oorlandoni Published |


    you have a comment ‘// meta caps (don’t assign these to roles)’. What do you mean by this?

    I want to disable the ‘delete_post’ option for a specific role, but I wonder why you state I can’t assign it to a role.

    thanks in advance!

  13. oorlandoni
    oorlandoni Published |

    I haven’t found a method yet that will disable the creation of posts. Plugins only focus on edit/publish permissions etc. That’s why I consider this approach.

  14. Clone role capabilities for a post type - Technology
  15. Sal Ferrarello
    Sal Ferrarello Published |

    Just a heads up, I think the ‘name_admin_bar’ value under labels, should be singular (“Example”) rather than the current plural version.

    If I understand properly, this label populates the “New” menu in the admin bar and the other entries there are singular (Post, Page).

    Thanks for this great resource.


Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.