set_post_type( integer $post_id = 0, string $post_type_key = 'post' );
This construct (function) updates the post type for the specific post ID. It uses
$wpdb to update post type column for the given post ID. In other words, it sets the new post type name into the
post_type column in the
wp_posts database table. Then it clears the post cache for the post ID, as the information is new and needs to refreshed.
- The key or slug for the new post type name. The default value is
Returns the number of rows affected, which should be a value of 1, if the update was successful. Else
false 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.