How to Remove HubSpot CTA Button Strings in HubSpot to WordPress Migration


How to Remove HubSpot CTA Button Strings in HubSpot to WordPress Migration

When migrating a HubSpot blog to WordPress or another CMS you will often find text strings in your articles that look like this {{cta('4cdfhg-a57e-dfh-dfh-5c6dfhgdfhdfgc','justifycenter')}}

Most likely you are going to replace those with a new button pointing to a landing page but that takes time to update. Also doing a database find and replace would work but that can also be risky because you are not 100% sure what and where things are being changed.

A safer option would be to use javascript to hide the text string on the frontend. This will also help later on when the site is indexed in Google because you can search your site for that string and manually update the posts when you have the time.

Below is some code to help you find all HubSpot CTA strings in your blog posts. Add this to a javascript file loaded in your site.

// Hide HubSpot CTA text strings
var str = jQuery("article").html();
var regex = /\{{cta(.*?)\}}/g;
// if you want to completely remove it
//jQuery("article").html(str.replace(regex, ' '));
jQuery("article").html(str.replace(regex, '<span class="hs-cta">$&</span>'));  

View codepen demo

About the Author

Jake Lett is a results-driven Detroit based B2B marketing consultant with 15+ years of hands-on experience managing SEO and PPC campaigns across manufacturing, SaaS, and professional services industries. He’s a Certified Google Ads Specialist and HubSpot CMS Developer who has personally managed budgets ranging from $500 to over $10,000/month.

Jake specializes in helping small businesses and solo marketers get more from lean ad budgets—using practical strategies that drive qualified leads, not just traffic. He shares real-world lessons on his blog, YouTube channel, and in his published books on digital marketing.



Related posts

Tags: , , ,

Want to Get Email Updates of New Articles?

Join My Email Newsletter