您可以使用wp\\u update\\u post更新帖子类型:
$my_post = array(
\'ID\' => $post_id,
\'post_type\' => \'winner\',
);
wp_update_post( $my_post, true );
// check if it failed and tell the user why
if ( is_wp_error( $post_id ) ) {
$errors = $post_id->get_error_messages();
foreach ( $errors as $error ) {
echo \'error: \'.esc_html( $error );
}
}
在哪里
$post_id
是你要切换到的帖子的ID