WordPress Post Types
WordPress can contain and display several different types of content.
A single content item is usually called a post, although post is also a specific post type which may be a little confusing.
Internally, all of the Post Types are stored in the
wp_posts database table — but are differentiated by a database column named
In addition to the default Post Types, WordPress gives you the capability to create Custom Post Types and use them in different ways.
Default Post Types
There are several post types that are used by the WordPress installation by default:
- Post (Post Type: 'post')
- Page (Post Type: 'page')
- Attachment (Post Type: 'attachment')
- Revision (Post Type: 'revision')
- Navigation Menu (Post Type: 'navmenuitem')
- Custom CSS (Post Type: 'custom_css')
- Changesets (Post Type: 'customize_changeset')
The Post Types can be modified and removed by a plugin or theme, but it’s not recommended that you remove built-in functionality for a widely-distributed theme or plugin.
The most common post types you will interact with as a Theme Developer are Post, Page, Attachment, Navigation Menu and Custom Post Types.
Post Post in WordPress is a post type that is typical for and most used by blogs.
They are displayed in reverse sequential order by time, with the newest post first and they have a date and time stamp. Posts may have the default taxonomies of categories and tags applied and also they are used for creating feeds.
Page Pages are a static Post Type, outside of the normal blog stream or feed. They are non-time dependent and without a time stamp, they are not organized using the categories and/or tags taxonomies.
Pages can have page templates applied to them and also can be organized in a hierarchical structure — i.e. pages can be parents or children of other pages.
Attachment Attachments are commonly used to display images or media in content, and may also be used to link to relevant files. They contain information (such as name or description) about files uploaded through the media upload system.
For images, this is also linked to metadata information, stored in the
wp_postmeta table, about the size of the images, the thumbnails generated from the images, the location of the image files and the HTML alt text.
Revision Revision is used to hold a draft post as well as any past revisions of a published post. For more information read our article WordPress Revisions.
Navigation Menu Navigation Menu is a type that holds information about a single item in the WordPress navigation menu system.
Custom CSS is a theme specific post used to store CSS saved from The Customizer's Additional CSS screen. Each theme could have their own post but only the active themes
custom_css post is used when displaying the theme.
WordPress will attempt to keep content changes made through The Customizer during the user session in a
customize_changeset post and attempt to pull them back up if the session gets destroyed.
Custom Post Types
Custom post types are new post types you can create. Custom Post Types are ways you can get a Posts- or Pages-like interface for whatever type of content you desire - portfolio, testimonials, projects, etc.
A custom post type can be added to WordPress via the
register_post_type() function in
functions.php theme file. This function allows you to define a new post type by its labels, supported features, availability and other specifics.
Custom Post Types are advanced topics and you are going to use and apply their capabilities if you start developing WordPress themes.