[wp-trac] [WordPress Trac] #40826: Allow items queried in batch via "slug" to maintain order

WordPress Trac noreply at wordpress.org
Mon May 22 22:41:13 UTC 2017


#40826: Allow items queried in batch via "slug" to maintain order
----------------------------------------------------+--------------------
 Reporter:  wonderboymusic                          |       Owner:
     Type:  defect (bug)                            |      Status:  new
 Priority:  normal                                  |   Milestone:  4.8.1
Component:  REST API                                |     Version:  4.7.4
 Severity:  normal                                  |  Resolution:
 Keywords:  has-patch has-unit-tests needs-refresh  |     Focuses:
----------------------------------------------------+--------------------
Changes (by jnylen0):

 * keywords:  has-patch => has-patch has-unit-tests needs-refresh
 * milestone:  4.7.6 => 4.8.1


Comment:

 This change seems fine for a 4.8.x release, but I have a few specific
 points of feedback.

 1. I think `included_slugs` is a better name for this new `orderby`
 parameter.  It's very similar to the existing `include` functionality that
 deals with IDs, so the word `include` should appear in the name somewhere.
 `slugs` is too similar to the existing `slug` which just means "order by
 slug".

 2. The new functionality added to `WP_Term_Query` should follow the naming
 convention of similar functionality in the rest of the `WP_*_Query`
 classes: `fieldname__in` (`slug__in` in this case).

 3. At least for posts, you can use the `$this->assertPostsOrderedBy()`
 helper to make for more precise tests and avoid having to create a bunch
 of test fixtures.  With wider use, this should speed up the test suite
 pretty significantly.

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


More information about the wp-trac mailing list