aircolor memolog

Web制作・テクノロジー、たまに旅行記

Intuitive Custom Post Orderの並び順をWP-REST-APIに反映する

Intuitive Custom Post Orderを有効にしても、デフォルトではWP-REST-APIの並び順に反映されない模様。functions.phpに以下のadd_filterを追記することで並び替えを有効化できます。

add_filter( "rest_post_query", function( $args, $request ) {
    $args['orderby'] = 'menu_order';
    return $args;
}, 10, 2 );

元記事

wordpress.stackexchange.com