Post Types in WordPress

After I posted about Post Formats in WordPress a friend of mine asked this question:

“What’s the difference between post formats and post types?”

At the time I didn’t think there was any difference, but then I spent some time digging around in the WordPress documentation and reading a bunch of other people’s articles about WordPress, and I think I’ve come up with a way to understand what everybody’s talking about.

The confusion is due to the word “post” and how it’s used.

According to the codex there are five (5) built-in post types:

  • post
  • page
  • attachment
  • navigation menu
  • revision

You can also create custom post types. It turns out these are all stored in the same table in the WordPress database, but how they’re used is very different.

Post

Posts are entries that display in reverse order on your home page. Posts usually have comments fields beneath them and are included in your site’s RSS feed. – Codex

A post is a piece of content that is dated, can be assigned to one or more categories, and given multiple tags. Posts do not have a hierarchy (although the categories they are assigned to can be hierarchical) and do not normally appear in website navigation.

Page

Pages are for content such as “About,” “Contact,” etc. Pages live outside of the normal blog chronology, and are often used to present timeless information about yourself or your site — information that is always applicable. You can use Pages to organize and manage any content. – Codex

A page is content that is undated, and is not categorized or tagged. Pages do, however, have a hierarchy (i.e. a parent page, or “none”) which is typically reflected in the site navigation through menus or “breadcrumbs”.

Differences between Posts and Pages

A significant difference between posts and pages is that you rarely edit a post. Instead you would create a new post that refers to the old version but contains the new information. Think of this like a series of articles in a newspaper that are following a breaking story. As new information comes to light the story is rewritten, which may refer to the earlier article(s).

Pages, however, are frequently edited. The history of the page isn’t important to the reader so much as having the current information in an easily found location.

How you find things is another difference between posts and pages. Posts are always presented in lists, usually sorted in reverse-chronological order. They may be filtered by category, tag, or through a search term, but the visitor first encounters them in a list context.

Pages are discovered via the site’s navigation links.

The final difference (that I can think of anyway) is how they are formatted. Posts are formatted according to their post type (discussed in the earlier article) while pages are formatted according to page templates. Exactly how that’s done is determined by the theme being used (the subject for a later article).

Attachment

Attachment is a special post that holds information about a file uploaded through the WordPress media upload system, such as its description and name. – Codex

An attachment is a file uploaded to the site through WordPress and that WordPress thus knows about. The most common attachment is an image, but audio and video files and pdf documents are also fairly common. As far as I know there is no restriction as to the type of file that can be an attachment.

Why does WordPress care about attachments? Mostly because of the various things it does with images. It keeps track of titles, descriptions, and sizes for example, so that when an image is used in a post or page all of that information can be included in the <img> tag. You can also tell WordPress to use an image as a “featured image” for a post, which can then be used by the theme to change how that post is displayed in a list.

Revision

Revision is used to hold a draft post as well as any past revisions of a published post. – Codex

A revision is an old version of a post. Revisions are not visible to site visitors – only the current version is. If you turn on the Revisions section of the post editor (via Screen Options) you can see what’s changed from one revision to the next.

Navigation Menu

Navigation Menu is a type that holds information about a single item in the WordPress navigation menu system. – Codex

A navigation menu is the main way to build site navigation into your WordPress site. It consists of links to pages, post categories, and outside links, which you can organize in a hierarchical fashion. The theme controls where and how menus are displayed, but navigation menu type posts control what goes into them. You create and edit navigation menus via the Appearance -> Menus section of the Dashboard.

Custom Post Types

Custom post types are new post types you can create. – Codex

No discussion of WordPress post types is complete without mentioning custom post types (CPTs). Basically, if you can thank of something you want to include in your site that doesn’t fit (or can’t be made to fit) in one of the types mentioned above you can create your own custom post type via a plugin and include it that way. It will have its own navigational environment (separate from the lists of posts or the hierarchy of pages) and may include its own organizational taxonomy (i.e. categories or tags, but just for this new type).

Possible CPTs include:

  • Events (organized by date/time of the event, displayed in a calendar or agenda format)
  • Company Directory (organized alphabetically, by department, or by job title)
  • Testimonials (quotes including name, picture, company, and job title)
  • Products (pictures, description, pricing, and organized via multiple taxonomies)

Pretty much every custom post type I can think of is structured some way, so that’s a clue as to when you might want to use a CPT. CPTs are such a big topic that I suspect I will be writing lots more about them later, so I’m going to stop for the time being.

Bottom line is “post” is a rather nebulous term in WordPress. It can refer to the act of publishing something (“I posted an article”), an article that is dated, or an entry in the wp_posts database table (of any post type). Being familiar with post types can help you figure out what someone means when they say “post”.

I hope you found this useful. Let me know what you think in the comments below.

Did you like this? Take a second to support me on Patreon!