Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]

My client’s website is moved from http to https, and I have updated most of the URLs using queries in phpMyAdmin, but I have been unable to update shortcode URLs.

I have used the following query to replace the URLs in post_content, but it has no effect on the shortcode URLs:

UPDATE `wp_posts`
SET post_content = REPLACE(post_content, 'src="http://example.com', 'src="https://example.com')
WHERE post_content
LIKE '%src="http://example.com%';

Update:

The following wp-cli command produced a single match in the wp_yoast_seo_links table:

wp search-replace 'http://example.com' 'https://example.com' --dry-run --skip-columns=guid

I also tried --all-tables in the command, and it produced more results, but only for Wordfence and other security tables.

Any ideas on why it is not finding URLs placed via short codes?

Note: Shortcodes inserted using DIVI plugin.

1 Answer
1

You should try running WP-CLI’s search-replace command.

$ wp search-replace 'http://example.com' 'https://example.com' --all-tables

But you said these URLs are placed from a shortcode? Then you need to find out what this shortcode actually is doing. As it not necessarily has saved the URLs to the database. Maybe it’s a setting in the shortcode and then the URL gets generated accordingly? You could also dump your database (maybe with WP-CLI again: $ wp db export test.sql) and open that with a text editor to see if you still can find the old URL in there.

Leave a Comment