| | 289 | } |
|---|
| | 290 | |
|---|
| | 291 | /** |
|---|
| | 292 | * set_post_type() - Set post type |
|---|
| | 293 | * |
|---|
| | 294 | * {@internal Missing Long Description}} |
|---|
| | 295 | * |
|---|
| | 296 | * @package WordPress |
|---|
| | 297 | * @subpackage Post |
|---|
| | 298 | * @since 2.4 |
|---|
| | 299 | * |
|---|
| | 300 | * @uses $wpdb |
|---|
| | 301 | * @uses $posts {@internal Missing Description}} |
|---|
| | 302 | * |
|---|
| | 303 | * @param mixed $post_id post ID |
|---|
| | 304 | * @param mixed post type |
|---|
| | 305 | * @return bool {@internal Missing Description}} |
|---|
| | 306 | */ |
|---|
| | 307 | function set_post_type( $post_id = 0, $post_type = 'post' ) { |
|---|
| | 308 | global $wpdb; |
|---|
| | 309 | |
|---|
| | 310 | $post_type = sanitize_post_field('post_type', $post_type, $post_id, 'db'); |
|---|
| | 311 | $return = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_type = %s WHERE ID = %d", $post_type, $post_id) ); |
|---|
| | 312 | |
|---|
| | 313 | if ( 'page' == $post_type ) |
|---|
| | 314 | clean_page_cache($post_id); |
|---|
| | 315 | else |
|---|
| | 316 | clean_post_cache($post_id); |
|---|
| | 317 | |
|---|
| | 318 | return $return; |
|---|