• Hi,
    We were using reorder posts with the WP REST API plugin. Now that the api is built in to wordpress, the posts endpoint does not accept an orderby value of menu_order. Is there a way to fix this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ronald Huereca

    (@ronalfy)

    If it’s not built into the core REST API, then likely not. I’d post a bug or feature enhancement in Trac and see if you can get some feedback there.

    Thread Starter jordan314

    (@jordan314)

    They allowed me to do it with this code:

    //allow orderby=menu_order
    add_filter( 'rest_post_collection_params', 'my_prefix_add_rest_orderby_params', 10, 1 );
    
    function my_prefix_add_rest_orderby_params( $params ) {
        $params['orderby']['enum'][] = 'menu_order';
    
        return $params;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Compatibility with wp API’ is closed to new replies.