Make WordPress Core

Ticket #4844: set_post_type.diff

File set_post_type.diff, 579 bytes (added by filosofo, 18 years ago)
  • wp-includes/post.php

     
    190190        return false;
    191191}
    192192
     193function set_post_type( $post_id = 0, $post_type = 'post' ) {
     194        global $wpdb;
     195        $return = $wpdb->query( "UPDATE $wpdb->posts SET post_type = '$post_type' WHERE ID = '$post_id'" );
     196        if ( 'page' == $post_type ) {
     197                clean_page_cache($post_id);
     198        } else {
     199                clean_post_cache($post_id);
     200        }
     201        return $return;
     202}
     203
    193204function get_posts($args) {
    194205        global $wpdb;
    195206