[wp-trac] [WordPress Trac] #40574: REST API orderby filter giving wrong output

WordPress Trac noreply at wordpress.org
Wed Apr 26 10:45:05 UTC 2017


#40574: REST API orderby filter giving wrong output
------------------------------+-----------------------------
 Reporter:  subrataemfluence  |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  REST API          |    Version:  4.7.4
 Severity:  normal            |   Keywords:
  Focuses:  rest-api          |
------------------------------+-----------------------------
 When using title as orderby filter in REST API endpoint the I am getting
 wrong output.


 == Test cases: ==


 '''[Case -A]'''
 {{{#!php
 /wp-json/wp/v2/api/trips?filter[orderby]=title&order=asc&per_page=1
 }}}

 '''Desired output (post title):''' "Amritsar, the city of Golden Temple"
 '''Actual output (post title):''' "Auli Ski Resort"

 '''[Case -B]'''
 {{{#!php
 /wp-json/wp/v2/api/trips?filter[orderby]=title&per_page=1
 }}}

 '''Desired output (post title):''' "Amritsar, the city of Golden Temple"
 '''Actual output (post title):''' "Dharamsala - The deemed smart City"

 I did not specify any order as the default order in any query is supposed
 to be Ascending.

 '''[Case - C]'''
 {{{#!php
 /wp-json/wp/v2/api/trips?filter[orderby]=title&order=desc&per_page=1
 }}}


 '''Desired output (post title):''' "Sundarvans - the largest mangrove
 forest"
 '''Actual output (post title):''' "Dharamsala - The deemed smart City"

 To cross check I tested with other custom post type but here again REST
 API gave me wrong result.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40574>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list