From fb8a8f9a08b5b414c5e5e74fcaed75de4e7862ca Mon Sep 17 00:00:00 2001 From: Paul Kirby Date: Mon, 27 Jan 2020 21:45:24 -0600 Subject: [PATCH] Support tagging feature when publishing If a post has tags applied, these will be sent as tags when published to the LBRY network --- classes/LBRY_Network_Publisher.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/classes/LBRY_Network_Publisher.php b/classes/LBRY_Network_Publisher.php index 3e52a0d..33bc443 100644 --- a/classes/LBRY_Network_Publisher.php +++ b/classes/LBRY_Network_Publisher.php @@ -9,7 +9,7 @@ class LBRY_Network_Publisher { /** * Publish the post to the LBRY Network - * @param int $post_id The ID of the post we are publishing + * @param WP_POST $post_id The ID of the post we are publishing * @param string $channel The Claim ID of the channel we are posting to */ // NOTE: This is currently sitting at about 150ms, mostly the post parsing @@ -50,6 +50,16 @@ class LBRY_Network_Publisher $args['thumbnail_url'] = $featured_image[0]; } + // Setup Tags + $tags = get_the_terms( $post, 'post_tag' ); + if ($tags) { + $tag_names = []; + foreach ($tags as $tag) { + $tag_names[] = $tag->name; + } + $args['tags'] = $tag_names; + } + // Build description using Yoast if installed and its used, excerpt/title otherwise $description = false; if (class_exists('WPSEO_META')) {