• Hello, and thank you for this marvelous plugin. I was wondering, is there a way i could pass the orderby in the Rest API, because my site uses the Rest API to fetch the posts (via Backbone Routing).

    Something like:

    Archive["home"].url = [apiUrl, 'wp/v2/posts/?filter[orderby]=menu_order&filter[posts_per_page]=16&page=1&', $query, '&_embed'].join('');

    assuming the “menu_order” is the order used by your plugin.

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    using the REST api shouldn’t impact the plugin. Are your posts not being returned ranked ?

    Thread Starter pkollias

    (@pkollias)

    Hello. OK I see. After the last update, the order changed by itself. Is there a way to recover it? Or does it have to be done again? I see that the order is not saved, even after re-ordering

    • This reply was modified 11 months, 1 week ago by pkollias.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    If it changed then there is a bug ??

    Can you tell me more what you mean by changed?

    Thread Starter pkollias

    (@pkollias)

    After the update, the post order is from a previous version! But as i told you, i am using the REST API to display my posts. Do you use a custom orderby , so i can pass it to the api call?

    Thread Starter pkollias

    (@pkollias)

    I think I understand what is going on. Firstly, I have to remove the “orderby” from my call to the API. Also, it seems that either the REST API or the browser caches the old sorting, so if i clear the cache, the order is showing as expected in the front-end.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    have to remove the “orderby” from my call to the API.

    indeed, unless you set the orderby override in the ReOrder admin page. The plugin allows also for dynamically overriding the orderby attribute (see the FAQ). Most queries don’t have an orderby, this really applies to custom post such as products in WooCommerce which can have oderby set by users wanting to rank products by various filters.

    Also, it seems that either the REST API or the browser caches the old sorting,

    you have 3 cache layers on a typical website,

    1. the server layer handled by WP core will cache post queries and the lifetime can be set with any cache management plugins.
    2. a CDN cache which is controlled by caching headers in your page
    3. and the browser cache which is also controlled by caching headers.

    so if i clear the cache, the order is showing as expected in the front-end.

    I am assuming you are referring to the 3rd layer on the browser. If you have a cache management plugin you can set the cache lifetime of your pages to ensure the content is purged regularly. Alternatively you can have longer caching times for pages that don’t change, but purge them manually when you update them in your admin.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Orderby in Rest API’ is closed to new replies.