• falconmick

    (@falconmick)


    Hey guys!

    When I try to use WP API + post Searching wp-json/wp/v2/posts?search=&page=1&perPage=100 the sorting that your pluggin creates doesn’t apply, I’ve also tried adding a orderby to my query but it doesn’t come up as an option as I get the following error: orderby is not one of author, date, id, include, modified, parent, relevance, slug, include_slugs, title.

    Is there any way to fix it so that this default search is set to your ordering system OR a way to add your orderby to the WP API’s search?

Viewing 1 replies (of 1 total)
  • Hi falconmick,

    I had the same issue with my Custom Post Order for a custom post type.

    I managed to get custom ordering working by adding support for ‘page-attributes’ when I registered my custom post type. Something like this:

    'supports' => array( 'title', 'taxonomy', 'revisions', 'page-attributes' )

    After that, I just had to add order=asc to my rest url so that it wasn’t in reverse/descending custom order.

    I hope that makes sense.

Viewing 1 replies (of 1 total)
  • The topic ‘Sort order not working (WP API)’ is closed to new replies.