Make WordPress Core

Ticket #4472: mtimport.diff

File mtimport.diff, 1.4 KB (added by shacker, 18 years ago)

MT importer gains ability to convert MT keywords to WP postmeta

  • mt.php

     
    220220                        if ( 0 != count($post->categories) ) {
    221221                                wp_create_categories($post->categories, $post_id);
    222222                        }
     223                       
     224                        // Add keywords. No way to add postmeta data with wp_insert_post(), so do it manually.
     225                        global $wpdb;
     226                        $table_name = $wpdb->prefix . "postmeta";
     227                        $insert = "INSERT INTO " . $table_name .
     228                                    " (post_id, meta_key, meta_value) " .
     229                                    "VALUES ($post_id,'mtkeywords','" . $wpdb->escape($post->keywords) . "')";
     230                        $results = $wpdb->query( $insert );                     
    223231                }
    224232
    225233                $num_comments = 0;
     
    268276
    269277                $context = '';
    270278                $post = new StdClass();
     279                $keywords = new StdClass();             
    271280                $comment = new StdClass();
    272281                $comments = array();
    273282                $ping = new StdClass();
     
    293302                                $context = '';
    294303                                $this->save_post($post, $comments, $pings);
    295304                                $post = new StdClass;
     305                                $keywords = new StdClass;                               
    296306                                $comment = new StdClass();
    297307                                $ping = new StdClass();
    298308                                $comments = array();
     
    392402                                        $post->extended .= $line;
    393403                                } else if ( 'excerpt' == $context ) {
    394404                                        $post->post_excerpt .= $line;
     405                                } else if ( 'keywords' == $context ) {
     406                                        $post->keywords .= $line;                                       
    395407                                } else if ( 'comment' == $context ) {
    396408                                        $comment->comment_content .= $line;
    397409                                } else if ( 'ping' == $context ) {