6R - WP_Post Object

WP_Post object

In wordpress, wp_post is a data structure used to hold a post or a page in the database. Post and pages are stored as an entry in the wp_posts table.

WP_Post object data contained in the object

Multiple variables get stored within the WP_POST object such as the post's ID, post_author which stores the authors numeric user ID, post_type contains the posts type, post_title stores the title, post_date storing time and date. The list goes on, as wp_post has about 17 different variables that can be stored.

WP_Post object role

The role of WP_Post is to contain post objects that are stored in by the database. This is usually returned by functions like get post.

Summary

wp_post plays a crucial role when dealing with posts as this function is used to create, update, or manipulate posts in the wordpress database. With wp_post, users can bet that posts are created or modified consistently, while having an advantage from wordpress built in functions like proper handling of post types.