3

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.

closed as off-topic by Krzysiek Dróżdż, Jacob Peattie Apr 17 at 4:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Have you already tried it with WP-CLI's wp search-replace 'http://example.com' 'https://example.com'? – leymannx Apr 16 at 18:10
  • @leymannx No, I do not have it installed. Does it provide more advanced find and replace functionality? Searching via SQL and phpMyAdmin return zero results after running these update commands. – Mike Hermary Apr 16 at 18:13
  • Ditto to @leymannx's comment - use WP-CLI's search-replace. It will make your life MUCH easier. You can do a dry run to see what it will update before doing the real thing. It makes migrating and updating WP sites a snap. – butlerblog Apr 16 at 18:20
  • Hi Mike, welcome to WPSE. Please note that 3rd party plugin related questions are off topic in WPSE. However, sometimes the same question can be asked in a different way to make it on-topic HERE. I've edited your question to make it closer to being on topic on WPSE. Hopefully the moderators will reconsider. – Fayaz Apr 18 at 16:01
  • 2
    Now about the question: Shortcode generated links are not always saved in the database, so depending on how the shortcodes were created and placed on your site, it's entirely possible that the links are generated instead of being served from the database. If they are indeed generated, then it's likely that there are settings somewhere in that plugin to make it https. So I suggest you check the shortcode settings. – Fayaz Apr 18 at 16:03
3

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.

  • I ran the command, but no luck. See my edited question. – Mike Hermary Apr 16 at 19:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.