File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -898,6 +898,36 @@ Each JSON API method invokes an action when called.
898
898
exit;
899
899
}
900
900
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
+
901
931
## 5.2. Developing JSON API controllers
902
932
903
933
### Creating a controller
You can’t perform that action at this time.
0 commit comments