Last active
February 14, 2024 03:30
-
-
Save leoloso/096b42bf6d1d763ca89e5ddaac505913 to your computer and use it in GitHub Desktop.
Add audio_url post meta to new podcast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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