The Difference Between Wordpress Posts, Pages, and Custom Post Types
Seb Toombs
Mar 18 2019 ()
4 min read
Posts, pages & custom posts; what's the difference?
As a Wordpress beginner, it can be tricky to understand the difference between posts, pages, and other post types. Posts & pages are the two main built-in or default content types in Wordpress, so we'll cover those first before talking about other, custom, post types.
Wordpress Posts
Let's start with posts. Wordpress posts are the most basic content type. At the most basic level a post is a data object that has;
- a unique ID - in Wordpress this is an integer number, known as the post_id usually
- A title - The title of this post is "The difference between Wordpress posts, pages, and custom post types". This can be anything you like as long as it's a string.
- Some content - usually this is the part you read, however technically it can be pretty much anything (text, images, shortcodes, html etc)
- Some other data such as the author, creation date etc
It helps to remember that Wordpress was designed as (and really, without any extension, still is) a blogging platform. In this blogging platform design, a post is intended to represent just that; one post in a blog. What you're reading right now is a post in our blog.
Posts can appear on their own (single post), like where you're probably reading this now, or they can appear in the blog index. The blog index is the list of blog articles. If you want to see our blog index, head here.
Because of Wordpress' origin as a blogging platform, the post data type is usually used as a blog post, just like this one. Sometimes business websites using Wordpress might rename this section to "News" or something similar.
Posts are able to be grouped together under a "blog" url. You can find this under Settings -> Permalinks and define a "Custom Structure" such as /blog.
Pages
Wordpress pages are very similar to posts. In fact, pages & posts are actually all stored in the same database table, wp_posts. From a purely data point-of-view the only thing separating a post and a page is the value of a special field stored in the database "post_type". For a post, the post_type is "post" and for a page the post_type is "page". Pretty straightforward. The differences are in how the Wordpress core interprets and uses the post and page data. Where posts form part of the blog, and are shown in the blog index, pages are sort of on their own. A page has all the same data as a post, title, content, an ID etc. Pages can have other pages that are their children which allows you to create "nested" URL structures. An example of a use for a page might be to create an "About Us" page. If your website is for a company, you might also have an "Our Mission" page which could be a child of the "About Us" page. Then your URL might look like /about-us/our-mission.
Custom Post Types
Wordpress supports posts and pages straight out of the box. No additional configuration is necessary. Earlier I mentioned that both posts and pages are essentially the same. They have the same data fields, they live in the same database table. Well what you might not know is that almost all key data in Wordpress is stored as a post! Wordpress, in classic Wordpress fashion, is very flexible, and every entry in the wp_posts database table has a field called post_type that lets Wordpress know what type of post it is. This means we can create any custom post types we want!
Many plugins store their data as custom posts; Woocommerce uses a custom post type called product to store product information for example.
When to Use a Post, Page, or Custom Post Type
It can be tricky as a Wordpress beginner to identify which content type to use to store your data. Here's a very quick guide;
- Use a page if the content is "stand-alone", i.e. it doesn't belong in a collection with any other data. Good examples are an About Us page or Contact Us page.
- Use a post if your content could be part of a larger collection, preferably in a blog or news type format.
- Use a custom post type for content that belongs in a collection but doesn't belong in the blog section. This could be locations for a brick and mortar business' stores, or products, team members etc.
Hopefully you have a better idea of how to use Wordpress posts, pages and custom posts to create a Wordpress blog or site.