Action
rpress_api_output_before
On this page
Fires before the API response is rendered.
Runs in RPRESS_API::output() right after the HTTP status header is sent and before the response body is produced in the chosen format. Use it to send extra headers or to inspect the data about to be output.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$arg1 | array | The response data about to be output. |
$this | RPRESS_API | The API instance. |
$format | string | The resolved output format. |
Example#
function my_api_before_output( $data, $api, $format ) {
if ( 'json' === $format ) {
header( 'X-My-Api-Version: 1' );
}
}
add_action( 'rpress_api_output_before', 'my_api_before_output', 10, 3 );
Source#
Fired from:
includes/api/class-rpress-api.php(line 1504), inRPRESS_API::output()includes/class-rpress-api.php(line 1108), inRPRESS_API::output()
See also#
Was this page helpful?
