[wp-trac] [WordPress Trac] #44349: Posts show up multiple times in backend, when imported with Import WordPress tool

WordPress Trac noreply at wordpress.org
Mon Jun 11 22:53:06 UTC 2018


#44349: Posts show up multiple times in backend, when imported with Import
WordPress tool
-------------------------------------------+------------------------------
 Reporter:  wzshop                         |       Owner:  (none)
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  Awaiting Review
Component:  Query                          |     Version:  4.9.6
 Severity:  normal                         |  Resolution:
 Keywords:  reporter-feedback 2nd-opinion  |     Focuses:
-------------------------------------------+------------------------------

Comment (by pbiron):

 In pure-SQL terms, any query of the form:
 {{{#!sql
 SELECT column FROM table ORDER BY order_by_column LIMIT x,y
 }}}

 where
 1. `order_by_column`is indexed, and
 1. there are more than `y` rows with the same value in `order_by_column`
 that span the "pages" `x-1` and `x`

 could result in some rows from "page" `x-1` also appearing on "page" `x`.

 In `WP_Query` terms, the above translates into any query of the form:
 {{{#!php
 <?php
 $args = array(
     // the following are the indexed columns in the wp_posts table
     'orderby' => any of 'type', 'date', 'id', 'parent', 'author' or 'name'
     // each of the below "pagination" args results in a LIMIT clause
     'posts_per_page|showposts|posts_per_archive_page' => any value other
 than -1
 );
 $query = new WP_Query( $args );// including get_posts( $args )
 }}}

 There are other `WP_Query` corner cases that will exhibit the non-
 deterministic behavior as well, including but probably not limited to,
 hooking into any of `posts_orderby`, `posts_clauses`,
 `posts_orderby_request`, `posts_clauses_request`, `posts_request` to add
 any of the above (plus `wp_posts.post_status`, which is not directly legal
 in the args to `new WP_Query()`) to the "ORDER BY" clause of the SQL query
 that `WP_Query` ultimately executes.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44349#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list