WordPress.org

Make WordPress Core

Ticket #7061: wordpress-7061-import_description_as_excerpt.diff

File wordpress-7061-import_description_as_excerpt.diff, 1.1 KB (added by koke, 6 years ago)

Patch to import description as excerpt

  • wp-admin/import/rss.php

     
    8484                                // This is for feeds that put content in description 
    8585                                preg_match('|<description>(.*?)</description>|is', $post, $post_content); 
    8686                                $post_content = $wpdb->escape($this->unhtmlentities(trim($post_content[1]))); 
     87                        } else { 
     88                                // This is for feeds that put content in description 
     89                                preg_match('|<description>(.*?)</description>|is', $post, $post_excerpt); 
     90                                $post_excerpt = $wpdb->escape($this->unhtmlentities(trim($post_excerpt[1])));                      
    8791                        } 
    8892 
    8993                        // Clean up content 
     
    9397 
    9498                        $post_author = 1; 
    9599                        $post_status = 'publish'; 
    96                         $this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'guid', 'categories'); 
     100                        $this->posts[$index] = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt', 'post_title', 'post_status', 'guid', 'categories'); 
    97101                        $index++; 
    98102                } 
    99103        }