WP_Post|array|null get_post ( int|WP_Post|null $post_object_or_id = null, string $return_data_type = OBJECT, string $field_filter = 'raw' );
This function fetches the post data from the database (or cache) for the given post ID or post object.
- optional The post ID or object which is used to fetch the data related to the one you want.
- optional Data type you want back from
get_post. Choices are:
ARRAY_N. It defaults to
- optional Sanitizing filter you want to run on all of the fields in the post data. You will need to use sanitize_post and configure up which filters to apply. It defaults to
raw. Choices are:
Returns the post data in the data type you requested. If something went wrong, such as the post does not exist,
null is returned.
Your functions are bloated. Put them on a diet. Think "skinny" and "as few lines as possible."
More coming soon…keep checking back.