wp-cli search-replace not updating URLs in button modules

Hi guys,

I’ve had this problem come up on two separate instances now with separate websites.

Here are the details of the problem:

  • Site is hosted via Go Daddy "managed" WP plan
  • I migrate site from external dev environment into Go Daddy
  • I update all URLs in DB using wp-cli (as that's the only way Go Daddy let's you manipulate the DB with these kinds of plans)
  • search-place command show me that all instances of old URL in the DB have been replaced.
  • When I check the site everything works perfectly, except for that the URLs set within button modules have not been updated. (It's possible that URLs within regular text module aren't updating, but my sites didn't have any links set in those.)
  • When I clear the Beaver Bulder cache the error persists

Fortunately there are not too many instances of these buttons as updating each one manually isn’t such a big deal, but I’d like to be able to avoid this problem on future deployments.

Any advice?

Hey Evan,

Thanks for getting in touch! Did you make a backup of the DB before you updated it? We recommend using the Serialized Search and Replace script when migrating sites. You can check the KB article below.
http://forum.wpbeaverbuilder.com/knowledge-base/migrating-a-site-to-another-domain/

You can also use the plugin Better Search Replace as it is based off the same script.

Ben

Thanks for your response.

Of course I made a backup of the database before making any changes :slight_smile:

As per the documentation at wp-cli, the search-replace function the search-replace function “will correctly handle serialized values, and will not change primary key values.”

I may be mistaken, but I believe this function is based on a fork of the script that you linked me to.

I’m at a loss as to what can be causing the problem. At this point, I would say that more testing is needed to see if this error is replicated in other hosting environments. If I get the opportunity to run some additional tests I will report back and let you know.

But in the meantime I would look into the compatibility of Beaver Builder with the wp-cli script, as I know it’s quickly gaining popularity.

Hey Evan,

I’ll run the wp-cli script through the guys and see what they say. For now, I’d suggest migrating the DB again and this time use the script/plugin mentioned above and see if you get the same problem.

How does the wp-cli script work though? Do you get to control what to search for and what to replace it with?

Ben

wp-cli works much like the search and replace DB script from InterconnectIT, but via a command line interface. You can easily control what gets searched for and what gets replaced.

Check out the examples on the documentation page here: http://wp-cli.org/commands/search-replace/

First of all: I do not like to dive into the SQL if I don’t need to and second: I like to prevent these troubles. So when I moved a site from local dev to the final server I had to redo all the buttons. I did that once. The second time I used a DB search-and-replace and went on looking for a better solution.

Found it! I’m using a plugin called URL Shortcodes. With that you can change the URL of the button from mysite.dev/page to [url_base]/page.

This will use the base URL from the site and this will still work in a completely different named site.

The plugin saved me a lot of time in my latest project in which I had to build more than 30 pages, all with images with buttons and call-to-actions.

I even made a shortcode for the shortcode with Text Expander: let the computer do all the typing.

Hey Deskman,

Thanks for sharing the solution. We recommend using either the Serialized Search and Replace script or the Better Search Replace plugin. You can also check the KB article below which discusses how to migrate BB sites from one domain to another.
http://forum.wpbeaverbuilder.com/knowledge-base/migrating-a-site-to-another-domain/

Evan,

Sorry to have left you hanging here, I could have sworn I assigned one of the guys to this thread. I’ll do it now. :slight_smile:

Ben

Hey Evan! Are you running any caching or security plugins on the site? Also, would it be possible to set us up with a temporary admin login so we can poke around? Lastly, if you can set us up with a copy of the wp-content folder and the database (pre migration), we can try to recreate the problem here. If it’s not a huge site, this would be really helpful! Let me know if it’s possible. Thanks!

Found it! I’m using a plugin called URL Shortcodes. With that you can change the URL of the button from mysite.dev/page to [url_base]/page.

This will use the base URL from the site and this will still work in a completely different named site.

Sorry: don’t use this tip. I tested it and it worked but in most cases the shortcode is rewritten and becomes http://base_url/whatever

Hey Deskman,

Thanks for the feedback! If you haven’t yet, go over through the KB article I linked above. That’s the method we use to migrate sites from one domain to another and it hasn’t failed us since! :slight_smile:

Ben

I’ve also recently run into this problem. I discovered it on one site and then had to go and check others launched since page builder entered into our site designs last year and discovered other broken links.

I’ve been using WP CLI commands to change sites URL for ages and never had any issues up until now.

It would be super convenient not to have to install a plugin to manage this as we have WP CLI on the server so SSH into the server and running a command takes seconds not minutes at launch time.

just for the record here’s the command that we use

wp search-replace ‘//staging.example.com’ ‘//www.example.com’ --skip-columns=guid

The search and replace worked correctly except for button links on Beaver Builder pages

Cheers
Brendyn

Hey Brendyn. Thanks for the heads up. I will look into this and get back to you.

Brendyn, I had a chance to test this a bit.

Here’s what I did, I made a button on one of my pages, then I did a search replace on the exact button URL:

wp search-replace 'http://localhost/bbplay/no-bb-link-test/' 'http://localhost/bbplay/no-bb-link-test2/'

That worked fine, so I don’t believe we’re splicing up the URL or anything in the database. Are the button URLs using the same format that you’re attempting to search/replace?

I can’t think of any reason why the issue would only affect buttons!? It’s bizarre. If you have any ideas, we’re all ears.