Skip to content

Instantly share code, notes, and snippets.

@aguilar1181
Last active May 5, 2025 17:45
Show Gist options
  • Save aguilar1181/357a127f1dacf8bc7f070e5290ead03d to your computer and use it in GitHub Desktop.
Save aguilar1181/357a127f1dacf8bc7f070e5290ead03d to your computer and use it in GitHub Desktop.
Add custom headers to the webhook post request
<?php
/*
* Add custom headers to Ninja Forms webhook post request
* Webhook addon required. Works with NF version 3+
*/
add_filter( 'nf_remote_post_headers', 'nf_wh_custom_headers' );
function nf_wh_custom_headers( $headers ) {
// Assuming you have a way to securely store and retrieve the token
$token = 'your_bearer_token_here'; // Replace this with your actual token or a function to retrieve it securely
$headers = array(
'headers' => array(
'Authorization' => 'Bearer ' . $token )
)
);
return $headers;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment