admin管理员组

文章数量:1430519

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

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="', 'src="')
WHERE post_content
LIKE '%src="%';

Update:

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

wp search-replace '' '' --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. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

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', 'src="https://example')
WHERE post_content
LIKE '%src="http://example%';

Update:

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

wp search-replace 'http://example' 'https://example' --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.

Share Improve this question edited Apr 18, 2019 at 15:56 Fayaz 9,0172 gold badges33 silver badges51 bronze badges asked Apr 16, 2019 at 18:04 Mike HermaryMike Hermary 2193 silver badges11 bronze badges 5
  • Have you already tried it with WP-CLI's wp search-replace 'http://example' 'https://example'? – norman.lol Commented Apr 16, 2019 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 Commented Apr 16, 2019 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 Commented Apr 16, 2019 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 Commented Apr 18, 2019 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 Commented Apr 18, 2019 at 16:03
Add a comment  | 

1 Answer 1

Reset to default 3

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

$ wp search-replace 'http://example' 'https://example' --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.

本文标签: Need MySQL Query or WPCLI command to updates old URLs in Shortcodes