WordPress Pages

Pages are for the static content of your site, like About us, Contact or Privacy Policy. Unlike posts, pages are not shown by date and they do not use categories or tags.

Posts vs Pages

PointPostsPages
Content typeTime based (news, blog)Timeless (about, contact)
OrderNewest firstMenu or page order
Categories and tagsYesNo
CommentsUsually onUsually off
Parent and childNoYes (page hierarchy)
In RSS feedYesNo
Page templatesNoYes

How to add a page

  1. Go to Pages > Add Page.
  2. Write the title and content with the block editor.
  3. In the settings sidebar, choose a Template and a Parent if needed.
  4. Click Publish.

Parent and child pages

A page can have a parent. Then its URL has the parent slug in front of it, which is good to organize big sites. Let us make one from the command line and see the URL:

Terminal output

$ wp post create –post_type=page –post_title="Services" –post_status=publish –porcelain
5
$ wp post create –post_type=page –post_title="Web Design" –post_parent=5 –post_status=publish –porcelain
6
$ wp post list –post_type=page –fields=ID,post_title,post_parent,post_status
ID post_title post_parent post_status
6 Web Design 5 publish
5 Services 0 publish
2 Sample Page 0 publish
3 Privacy Policy 0 draft
$ wp eval 'echo get_permalink(6);'
http://example.com/services/web-design/

Set a static home page

Create two pages, Home and Blog, and then go to Settings > Reading. Choose A static page and select them. The same can be done with WP-CLI:

Terminal output

$ wp post create –post_type=page –post_title="Home" –post_status=publish –porcelain
7
$ wp post create –post_type=page –post_title="Blog" –post_status=publish –porcelain
8
$ wp option update show_on_front page
Success: Updated 'show_on_front' option.
$ wp option update page_on_front 7
Success: Updated 'page_on_front' option.
$ wp option update page_for_posts 8
Success: Updated 'page_for_posts' option.
$ curl -s http://example.com/ | grep -o "<title>[^<]*</title>"
<title>Demo Site</title>

Note: Never use a page for blog style content, because it will not show in your blog list, feed or archives. Next: WordPress Block Editor.

Congratulations! Chapter Finished. Learn more about the similar topics:
Exercises & Assignments
Add categories, a child category and a tag to a post
Interview Questions & Answers
How to limit WordPress post content length?
What is the difference between Posts & Pages in WordPress?
Which Gutenberg blocks support wide and full width alignment?
What is Post Status in WordPress?
What is the difference between categories and tags in WordPress?
What is Gutenberg in WordPress?