Skip to content
Docs
Get RestroPress

Action

rpress_realtime_publish_error

Updated
On this page

Fires when publishing a realtime order status event fails.

Runs in RPRESS_Realtime::broadcast_order_status() when the request to the websocket provider returns a WP_Error, either from the HTTP transport or from a non-2xx response. Use it to log failures or alert. For HTTP status errors the error data holds the response code and body.

Available since RestroPress 3.2.6.

Parameters#

ParameterTypeDescription
$resultWP_ErrorError object.
$payment_idintPayment ID.
$payloadarrayEvent payload: payment_id, order_number, status, status_label, status_color and updated_at_unix.

Example#

function my_realtime_publish_error( $result, $payment_id, $payload ) {
	error_log( sprintf( 'Realtime publish failed for order %d: %s', $payment_id, $result->get_error_message() ) );
}
add_action( 'rpress_realtime_publish_error', 'my_realtime_publish_error', 10, 3 );

Source#

Fired from:

  • includes/class-rpress-realtime.php (line 108), in RPRESS_Realtime::broadcast_order_status()

See also#

Was this page helpful?