wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
set_post_type › WordPress Function
Desde2.5.0
Obsoleton/a
› set_post_type ( $post_id = 0, $post_type = 'post' )
| Parâmetros: (2) |
|
| Retorna: |
|
| Definido em: |
|
| Codex: |
Updates the post type for the post ID.
The page or post cache will be cleaned for the post ID.Funções relacionadas: get_post_type, get_post_types, get_post_mime_type, get_post_time, register_post_type
Fonte
function set_post_type( $post_id = 0, $post_type = 'post' ) {
global $wpdb;
$post_type = sanitize_post_field( 'post_type', $post_type, $post_id, 'db' );
$return = $wpdb->update( $wpdb->posts, array( 'post_type' => $post_type ), array( 'ID' => $post_id ) );
clean_post_cache( $post_id );
return $return;
}