Understanding register_post_type()

WordPress uses built-in post types for normal everyday use, but you can extend the list of available post types by using a pivotal function: register_post_type(). It is this function that allows WordPress to fulfill more traditional CMS roles. For example, you could create a custom post type for "movies" with custom fields for "plot", "genre" and "rating". The important thing to realize is that any custom post types will be visible to WordPress only if you register them using the register_post_type() function, and as you may have guessed, the only way for you to do that is inside a plugin.

To really understand what this complex function does, we really need to get our hands dirty and try using it ourselves. You ...

Get WordPress 3 Plugin Development Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.