set_post_type( int $post_id, string $post_type = 'post' )
Updates the post type for the post ID.
Description
The page or post cache will be cleaned for the post ID.
Parameters
- $post_id
-
(Optional) Post ID to change post type. Default 0.
- $post_type
-
(Optional) Post type. Accepts 'post' or 'page' to name a few. Default 'post'.
Default value: 'post'
Return
(int|false) Amount of rows changed. Should be 1 for success and 0 for failure.
Source
File: wp-includes/post.php
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |