WP_Post
- Since
- 3.5.0
- Source
wp-includes/class-wp-post.php:21
Core class used to implement the WP_Post object.
Compatibility
- WordPress
- since 3.5.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 24
$IDintpublic- Post ID.
$post_authorstringpublic- ID of post author.
$post_datestringpublic- The post's local publication time.
$post_date_gmtstringpublic- The post's GMT publication time.
$post_contentstringpublic- The post's content.
$post_titlestringpublic- The post's title.
$post_excerptstringpublic- The post's excerpt.
$post_statusstringpublic- The post's status.
$comment_statusstringpublic- Whether comments are allowed.
$ping_statusstringpublic- Whether pings are allowed.
$post_passwordstringpublic- The post's password in plain text.
$post_namestringpublic- The post's slug.
$to_pingstringpublic- URLs queued to be pinged.
$pingedstringpublic- URLs that have been pinged.
$post_modifiedstringpublic- The post's local modified time.
$post_modified_gmtstringpublic- The post's GMT modified time.
$post_content_filteredstringpublic- A utility DB field for post content.
$post_parentintpublic- ID of a post's parent post.
$guidstringpublic- The unique identifier for a post, not necessarily a URL, used as the feed GUID.
$post_typestringpublic- The post's type, like post or page.
$post_mime_typestringpublic- An attachment's mime type.
$comment_countstringpublic- Cached comment count.
$filterstringpublic- Stores the post object's sanitization level.
Methods · 6
- get_instance()Retrieve WP_Post instance.
- __construct()Constructor.
- __isset()Isset-er.
- __get()Getter.
- filter(){@Missing Summary}
- to_array()Convert object to array.
Source code
#[AllowDynamicProperties]final class WP_Post { /** * Post ID. * * @since 3.5.0 * @var int */ public $ID; /** * ID of post author. * * A numeric string, for compatibility reasons. * * @since 3.5.0 * @var string */ public $post_author = '0'; /** * The post's local publication time. * * @since 3.5.0 * @var string */ public $post_date = '0000-00-00 00:00:00'; /** * The post's GMT publication time. * * @since 3.5.0 * @var string */ public $post_date_gmt = '0000-00-00 00:00:00'; /** * The post's content. * * @since 3.5.0 * @var string */ public $post_content = ''; /** * The post's title. * * @since 3.5.0 * @var string */ public $post_title = ''; /** * The post's excerpt. * * @since 3.5.0 * @var string */ public $post_excerpt = ''; /** * The post's status. * * @since 3.5.0 * @var string */ public $post_status = 'publish'; /** * Whether comments are allowed. * * @since 3.5.0 * @var string */ public $comment_status = 'open'; /** * Whether pings are allowed. *Changelog
Introduced in 3.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/class-wp-post.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.