开发者 | 4samy |
---|---|
更新时间 | 2016年11月1日 12:20 |
PHP版本: | 1.0.1 及以上 |
WordPress版本: | 4.6.1 |
版权: | MIT |
版权网址: | 版权信息 |
add_filter( 'json_query_vars', 'filterJsonQueryVars' ); function filterJsonQueryVars( $vars ) { $vars[] = 'meta_key'; return $vars; }
dowmian.com/wp-json/posts?filter[orderby]=meta_value_num&filter[meta_key]=order&filter[order]=ASC
filter[orderby]: Either meta_value or meta_value_num depending on whether you're filtering on an alphanumeric value or a numeric value
filter[meta_key]: The key you want to filter on, this is the name of the ACF field
filter[order]: The order to receive the data in, ASC or DESC
See the CONTRIBUTING.md
file.
= How can I filter posts on a custom field?