6R - WP_Post Object

WP_Post object summary

The WP_Post object is used to contain post objects that are stored by the database. WP_Post objects are returned by functions such as get_post.

WP_Post object data contained in the object

There are several variables stored within WP_Post objects such as post_author, post_type, post_title, post_date_gmt, ID, post_content, post_excerpt, post_status, comment_status, ping_status, post_parent, post_modified, comment_count and much more. In order to get data from WP_Post objects the code must look similar to the following code based on what you are trying to get information from ?php $example = get_post();echo $example->post_title;.

WP_Post object role in the page load

The WP_Post class is used to hold post objects that are stored by the database and are returned by a function, for example get_post. There are many different methods in WP_Post such as construct, get, isset, filter, get instance and to array.

Summary

WP_Post is a great way for you to store all the information that is needed in a post that you will eventually be able to echo onto your website that the viewers will be able to see.