Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wp-seopress/5756814961d4c2d2900eb5ca7a317654 to your computer and use it in GitHub Desktop.
Save wp-seopress/5756814961d4c2d2900eb5ca7a317654 to your computer and use it in GitHub Desktop.
Filter the arguments sent to OpenAI to generate alternative texts
add_filter('seopress_ai_openai_request_args_alt', 'sp_ai_openai_request_args_alt');
function sp_ai_openai_request_args_alt($args) {
//do your stuff, this is just an example
//var_dump($body)
$args = [
'body' => json_encode($body),
'timeout' => '30',
'redirection' => '5',
'httpversion' => '1.0',
'blocking' => true,
'headers' => [
'Authorization' => 'Bearer ' . seopress_pro_get_service('Usage')->getLicenseKey(),
'Content-Type' => 'application/json'
],
];
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment