WP REST API tutorial
-
If you want to use it through the rest api, you need to add the following code to your functions.php:
//Add menu order support for REST API 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; }
Then, query e.g:
https://yoursite.com/wp-json/wp/v2/posts?orderby=menu_order&order=asc
Thanks for the plugin, it’s great! ??
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WP REST API tutorial’ is closed to new replies.