wp_posts

Published: 3 Mar 2023

The wp_posts table stores information about WordPress posts and pages, such as slug, title, author, status, or date when the post was published or modified. Additional information can be stored in wp_postmeta table.

It excludes the information on categories and tags, which are in wp_term_relationships table, and on comments (other than a single column for total comment count), which are in wp_comments table.

Columns

ID: Auto incrementing integer ID used as unique identifier for each post and primary key. Unlike ID columns in some other tables, post ID is very important, as it is used to link information in other tables (e.g. postmeta, comments, or terms) to individual posts.

post_author: ID of the post author. It is the ID column from wp_users table.

post_date: Date and time the post was published, in the format "YYYY-MM-DD HH:MM:SS", in the WordPress website's timezone.

post_date_gmt: Date and time the post was published, as "YYYY-MM-DD HH:MM:SS", in GMT timezone.

post_content: Content of the post. This column stores the post text and other content in HTML (which may include WordPress shortcodes).

post_title: Title of the post. This is usually displayed in HTML head title and also in the h1 heading on the individual post page.

post_excerpt: Excerpt of the post, which is a short summary of the post content. It is optional – if empty, auto generated excerpt will be used.

post_status: Status of the post. Possible values include "publish", "future", "draft", "pending", "private", "trash", "auto-draft", and "inherit" (for attachments and revisions).

comment_status: Status of comments on the post. Possible values are "open", "closed", or "registered_only".

ping_status: Status of pingbacks and trackbacks on the post. Possible values are "open" or "closed".

post_password: Password for the post (if set).

post_name: Post slug, which is the specific part of URL that idendities each post, such as "wp-posts-table" for this page. It must be unique.

to_ping: List of URLs to ping when the post is published or updated.

pinged: URLs that have been pinged for the post.

post_modified: Date and time when the post was last modified, in the format "YYYY-MM-DD HH:MM:SS", in WordPress site's timezone.

post_modified_gmt: Date and time when the post was last modified, as "YYYY-MM-DD HH:MM:SS", in GMT timezone.

post_content_filtered: Filtered version of the post content, which may exclude certain elements or tags.

post_parent: ID of the post's parent. This column specifies the ID of the post's parent, if the post is a child post or attachment. It is the ID column value from wp_posts for the parent post.

guid: Global unique identifier for the post. This is used in RSS feeds and other external applications.

menu_order: The order of the post in menus.

post_type: The type of post, such as "post", "page", "attachment", "revision", "nav_menu_item", etc.

post_mime_type: The MIME type of the post, such as "image/jpeg", "image/gif", "application/pdf" etc.

comment_count: The number of comments associated with the post.

SQL Schema

CREATE TABLE `wp_posts` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`post_author` bigint(20) unsigned NOT NULL DEFAULT 0,
`post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_content` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`post_title` text COLLATE utf8mb4_unicode_ci NOT NULL,
`post_excerpt` text COLLATE utf8mb4_unicode_ci NOT NULL,
`post_status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'publish',
`comment_status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'open',
`ping_status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'open',
`post_password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`post_name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`to_ping` text COLLATE utf8mb4_unicode_ci NOT NULL,
`pinged` text COLLATE utf8mb4_unicode_ci NOT NULL,
`post_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_modified_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_content_filtered` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`post_parent` bigint(20) unsigned NOT NULL DEFAULT 0,
`guid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`menu_order` int(11) NOT NULL DEFAULT 0,
`post_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'post',
`post_mime_type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`comment_count` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (`ID`),
KEY `post_name` (`post_name`(191)),
KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`),
KEY `post_parent` (`post_parent`),
KEY `post_author` (`post_author`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

By remaining on this website or using its content, you confirm that you have read and agree with the Terms of Use Agreement.

We are not liable for any damages resulting from using this website. Any information may be inaccurate or incomplete. See full Limitation of Liability.

Content may include affiliate links, which means we may earn commission if you buy on the linked website. See full Affiliate and Referral Disclosure.

We use cookies and similar technology to improve user experience and analyze traffic. See full Cookie Policy.

See also Privacy Policy on how we collect and handle user data.

© 2024 WPDir