[wp-trac] [WordPress Trac] #28146: Export Filter for Post IDs
WordPress Trac
noreply at wordpress.org
Thu Sep 10 09:24:58 UTC 2015
#28146: Export Filter for Post IDs
----------------------------------------+-----------------------------
Reporter: zourbuth | Owner: westonruter
Type: enhancement | Status: accepted
Priority: normal | Milestone: 4.4
Component: Export | Version: 2.1
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests | Focuses: administration
----------------------------------------+-----------------------------
Comment (by ivanblagdan):
As far as I can tell, its related to a docbloc:
{{{
23ce2efd src/wp-admin/includes/export.php (Scott Taylor
2015-05-28 21:40:27 +0000 445) /**
23ce2efd src/wp-admin/includes/export.php (Scott Taylor
2015-05-28 21:40:27 +0000 446) * @global WP_Query $wp_query
23ce2efd src/wp-admin/includes/export.php (Scott Taylor
2015-05-28 21:40:27 +0000 447) */
}}}
Heres the export.php.rej as well:
{{{
***************
*** 377,397 ****
do_action( 'rss2_head' );
?>
- <?php if ( $post_ids ) {
- global $wp_query;
- // Fake being in the loop.
- $wp_query->in_the_loop = true;
- // Fetch 20 posts at a time rather than loading the entire table
into memory.
- while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
- $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
- $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where"
);
- // Begin Loop.
- foreach ( $posts as $post ) {
- setup_postdata( $post );
- $is_sticky = is_sticky( $post->ID ) ? 1 : 0;
?>
<item>
<title><?php
--- 433,460 ----
do_action( 'rss2_head' );
?>
+ <?php
+ if ( $post_ids ) {
+ $posts_per_page = 20;
+
+ $wp_query_args = array(
+ 'post_type' => 'any',
+ 'post_status' => 'any',
+ 'posts_per_page' => $posts_per_page,
+ 'post__in' => array_slice( $post_ids, 0,
$posts_per_page )
+ );
+
+ $query = new WP_Query( $wp_query_args );
+ $page = 0;
+ // Paginate posts 20 at a time
+ while ( $query->have_posts() ) {
+ // Begin Loop.
+ while ( $query->have_posts() ) {
+ $query->the_post();
+ $is_sticky = is_sticky( $post->ID ) ? 1 :
0;
?>
<item>
<title><?php
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28146#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list