Skip to content

Commit b74b313

Browse files
committed
Documentation update
1 parent 45d496e commit b74b313

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,36 @@ Each JSON API method invokes an action when called.
898898
exit;
899899
}
900900

901+
## Filter: json_api_http_status
902+
903+
Provides an override for the response HTTP status. Offered for backwards compatibility, since version 1.1.1 and older *always* returned HTTP 200.
904+
905+
### Example
906+
907+
// Retain old HTTP 200 statuses for legacy support
908+
add_filter('json_api_http_status', 'my_http_status');
909+
910+
function my_http_status() {
911+
return 200;
912+
}
913+
914+
## Filter: json_api_query_args
915+
916+
Provides an override for the [WP_Query](https://codex.wordpress.org/Class_Reference/WP_Query) arguments.
917+
918+
### Example
919+
920+
// Allow queries of non-published content
921+
add_action('json_api_query_args', 'my_query_args');
922+
923+
function my_query_args($args) {
924+
$args['post_status'] = array('draft', 'future', 'publish');
925+
}
926+
927+
## Action: json_api_query
928+
929+
Called after the JSON API introspector runs `wp_query`, passes the `WP_Query` object as its single argument.
930+
901931
## 5.2. Developing JSON API controllers
902932

903933
### Creating a controller

0 commit comments

Comments
 (0)