Ticket #3188: end_to_start_wp.diff

File end_to_start_wp.diff, 1.9 kB (added by westi, 2 years ago)

Kill off the final start_wp call

  • wp-includes/query.php

    old new  
    917917                        $where .= " AND (post_type = 'page')"; 
    918918                } elseif ($this->is_single) { 
    919919                        $where .= " AND (post_type = 'post')"; 
     920                } elseif ('export' == $post_type) { 
     921                        // don't extend the WHERE clause or limit it to post_type or post_status 
    920922                } else { 
    921923                        $where .= " AND (post_type = '$post_type' AND (post_status = 'publish'"; 
    922924 
  • wp-admin/export.php

    old new  
    5353header("Content-Disposition: attachment; filename=$filename"); 
    5454header('Content-type: text/wxr+xml; charset=' . get_option('blog_charset'), true); 
    5555 
    56 $where = ''
     56$author = 0
    5757if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) { 
    58         $author_id = (int) $_GET['author']; 
    59         $where = " WHERE post_author = '$author_id' "; 
     58        $author = (int) $_GET['author']; 
    6059} 
    6160 
    62 $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC"); 
     61$posts = query_posts('posts_per_page=-1&order=ASC&post_type=export&author='.$author); 
    6362?> 
    6463<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. --> 
    6564<!-- It contains information about your blog's posts, comments, and categories. --> 
     
    8786        <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator> 
    8887        <language><?php echo get_option('rss_language'); ?></language> 
    8988        <?php do_action('rss2_head'); ?> 
    90         <?php if ($posts) { foreach ($posts as $post) { start_wp(); ?> 
     89        <?php while (have_posts()) : the_post(); ?> 
    9190<item> 
    9291<title><?php the_title_rss() ?></title> 
    9392<link><?php permalink_single_rss() ?></link> 
     
    136135</wp:comment> 
    137136<?php } } ?> 
    138137        </item> 
    139 <?php } } ?> 
     138<?php endwhile; ?> 
    140139</channel> 
    141140</rss> 
    142141<?php