Skip to content

Instantly share code, notes, and snippets.

@leoloso
Last active February 14, 2024 03:30
Show Gist options
  • Save leoloso/096b42bf6d1d763ca89e5ddaac505913 to your computer and use it in GitHub Desktop.
Save leoloso/096b42bf6d1d763ca89e5ddaac505913 to your computer and use it in GitHub Desktop.
Add audio_url post meta to new podcast
<?php
add_action(
"gatographql__executed_query:ImportPostFromRSSFeed",
function (Response $response) {
/** @var string */
$responseContent = $response->getContent();
/** @var array<string,mixed> */
$responseJSON = json_decode($responseContent, true);
$postID = $responseJSON['data']['createPost']['post']['id'] ?? null;
if ($postID === null) {
// Do nothing
return;
}
// Complete here
$audioURL = '...';
add_post_meta($postID, 'audio_url', $audioURL, true);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment