Skip to main content

Hey there,

 

I’ve set up an automation with Zapier that runs whenever I publish a new YouTube video on my channel. The automation creates a post in WordPress by uploading the YT thumbnail as a featured image, title as a title and the link to the video as well as the YT video description as the post content. 

 

The problem I’m facing is that the links from my YT caption aren’t showing up as clickable links in the WordPress post. I’d love for this to be fixed, so that users on my website could read through the description and instantly click on the links. 

 

Is there a way to achieve this? I basically just need the URLs that are in the video description to be clickable...

The easiest way to do this would be with a code action that uses a regex expression to replace your URLs with anchor tags before adding it to the Wordpress post.

 


@GetUWired  thank you for your answer!

 

Do you have a RegEx that would do this? That would be great!


var result = inputData.description.replace(/(\b(https?|ftp|file):\/\/\\-A-Z0-9+&@#\/%?=~_|!:,.;]*]\-A-Z09+&@#\/%=~_|])/img, '<a href="$1">$1</a>');

return {'formattedOutput': result};


Here’s the javascript that I used in that code action, which includes the regex expression.


@GetUWired  Unfortunately I can’t seem to make it work. I get the following error back from Zapier when testing the zap:

 


@GetUWired any update on this? I’m probably doing something wrong, but I can’t seem to figure it out :sweat_smile:


@janosch.hrm 
Would you mind sharing a screenshot of how you have your code set up? 


@GetUWired Never mind, I actually got it to work now. I think I had a type in the name of the input field. Thank you so much for your help!


@janosch.hrm 

That’s great to hear! Glad we could help out!