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

  • read

Pasted into

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.

View codepen demo

Written by: Jacob Lett - Jacob is a HubSpot CMS designer & developer who helps B2B businesses grow their revenue. Unlike his competitors, he focuses on small and consistent website design changes to increase results. He recently created the Industrial HubSpot Theme to help manufacturers quickly build their website on the HubSpot CMS platform. Connect on LinkedIn
Category: Code Snippets
Tags: , , ,