set_post_type
set_post_type ( $post_id = 0, $post_type = 'post' )
Parameters:- (int) post_id Optional. Post ID to change post type. Default 0.
- (string) post_type Optional. Post type. Accepts 'post' or 'page' to name a few. Default 'post'.
Returns:- (int|false) Amount of rows changed. Should be 1 for success and 0 for failure.
Defined at: - Introduced in WordPress: 2.5.0
- Deprecated in WordPress: —
Description
Updates the post type for the post ID.The page or post cache will be cleaned for the post ID.