Wordpress The_post



Topics

The_post
  • Default Statuses

Posts in WordPress can have one of a number of statuses. The status of a given post determines how WordPress handles that post. For instance, public posts viewable by everyone are assigned the publish status, while drafts are assigned the draft status. The status is stored in the post_status field in the wp_posts table.

WordPress provides 8 built-in statuses you can use. WordPress 3.0 gave you the capability to add your own custom post status and to use it in different ways.

  1. The Post Grid is a fully Responsive & Mobile friendly plugin to display your page/post in Grid, List and Isotope View without any line of coding. It is fast and easy to generate grid from admin end and insert into page/post.
  2. In contrast to posts (which form an ever-evolving feed of content), pages are the evergreen elements of WordPress site. They’re a more ‘permanent’ fixture, and obvious examples are your About and Contact pages. Within WordPress, pages look similar to posts, although there are definite differences.

Workflow Workflow

Blog

The ‘thepost’ action hook allows developers to modify the post object immediately after being queried and setup. The post object is passed to this hook by reference so there is no need to return a value.

WordPress provides built-in features that empower some users (based on their Roles and Capabilities) to review content submitted to the website before it is published. This is commonly called “workflow.” WordPress’s workflow features rely on the value of a post’s post_status field to know which step in the workflow process the post is currently held in.

Most users are already familiar with at least two workflow states:

Wordpress The_post
  • Posts that are published and visible to everyone (including users who are logged out) are given the publish status.
  • Drafts that are not yet published are assigned the draft status.

Internally, WordPress sets the post status to publish when you click the “Publish” button, and WordPress sets the post status to draft when you click the “Save Draft” button. Similarly, if your website has users granted the edit_posts capability but not the publish_posts capability, then when those users start writing a new post, WordPress will display a “Submit for Review” button instead of a “Publish” button. Likewise, WordPress then assigns the post that user created the pending status when they press that button.

The status of a post can also be set in the Administration Screen and Add New Posts Screen by any user with the capability needed to assign the post to the given status. Internally, all of these posts are stored in the same place (the wp_posts table), and are differentiated by a column called post_status.

Default Statuses Default Statuses

There are 8 major post statuses that WordPress uses by default.

Publish Publish

Viewable by everyone. (publish)

Future Future

Scheduled to be published in a future date. (future)

Draft Draft

Incomplete post viewable by anyone with proper user role. (draft)

Pending Pending

Awaiting a user with the publish_posts capability (typically a user assigned the Editor role) to publish. (pending)

Private Private

Viewable only to WordPress users at Administrator level. (private)

Trash Trash

Posts in the Trash are assigned the trash status. (trash)

Wordpress The_post_thumbnail_url

Auto-Draft Auto-Draft

Revisions that WordPress saves automatically while you are editing. (auto-draft)

Inherit Inherit

Used with a child post (such as Attachments and Revisions) to determine the actual status from the parent post. (inherit)

The_post

Custom Status Custom Status

NOTICE:This function does NOT add the registered post status to the Administration Screen. This functionality is pending future development. Please refer to Trac Ticket #12706.Consider the action hook post_submitbox_misc_actions for adding this parameter.

A Custom Status is a Post Status you define.

Adding a custom status to WordPress is done via the register_post_status() function. This function allows you to define the post status and how it operates within WordPress.

Here’s a basic example of adding a custom post status called “Unread”:

Resources Resources

Related Related

Code Documentation Code Documentation

Wordpress Blog Posts Not Appearing

  • Function: get_post_status() – Retrieve the post status based on the Post ID.