Opened 8 years ago
Closed 8 years ago
#40574 closed defect (bug) (worksforme)
REST API orderby filter giving wrong output
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7.4 |
Component: | REST API | Keywords: | reporter-feedback |
Focuses: | rest-api | Cc: |
Description
When using title as orderby filter in REST API endpoint the I am getting wrong output.
Test cases:
[Case -A]
/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]
/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]
/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.
Change History (4)
#2
in reply to:
↑ 1
@
8 years ago
Thank you for your response. I am not using any plugin and rather I would like to code it by hand. The reason is I am new to WP and hence like to understand how things actually work. Don't I have an option to go without plugin?
Replying to ocean90:
Hello @subrataemfluence, the filter parameter has been removed in [38968], see #38378. Are you using the https://github.com/wp-api/rest-filter plugin?
Hello @subrataemfluence, the filter parameter has been removed in [38968], see #38378. Are you using the https://github.com/wp-api/rest-filter plugin?