This might not work for product descriptions in other complex CMS systems or whatever application it is. In my case, an old budgetless Prestashop installation, this dirty quick method does the job. A nice and easy way to replace a string using a query just like you would do it in a text editor with find and replace.Īnd I can’t stress this enough: be wary of what and where you replace so you don’t mess things up. In all fairness, you should really have a test installation or a backup so… yeah. Check it before you actually run the query.
UPDATE wpposts SET postcontent REPLACE ( postcontent, 'text to find here', 'text to replace here') So with the SQL code you put your text between the single quotes for what you are finding and what you are.
I know it’s logic, but it can be easily overlooked. So here switch to the ‘SQL’ tab add in the code below and click on the ‘Go’ button. Or else you’ll replace the HTTP part of a HTTPS link and you’ll end up with something like HTTPSS. Please note that in such scenarios, it is vital to also put those two dots… “:”. You can think about it like a phpMyAdmin find and replace. The above query will make all the links in the selected field go from HTTP to HTTPS. Your_table is your table’s name, your_field is the column name and the HTTP: and HTTPS: are the actual strings. SET your_field = REPLACE( your_field, ' HTTP:', ' HTTPS:') So the actual query we’re going to run is this: UPDATE your_table Go to the SQL tab (upper section of your screen).The situation above is described in this screenshot of PhpMyadmin:Īfter you’ve determined the name of the database, table, and column we need to work on and, most importantly, the string we need to replace and what to replace it with, do this in PhpMyAdmin: (I found out using Ahrefs Site Audit feature, but there are plenty of other tools and even just manually checking for issues is a thing) So we’ve identified about 600 descriptions that have HTTP image links to another domain somehow. And it has a column named ‘description’, where each product has its own description stored. So we have this table named ‘ps_product_lang’. But it’s not great as that image must be downloaded from somewhere else and not using the CDN or at least their own server and domain name. Especially bad when they copy-paste HTTP links (I know, can you believe their supplier’s website does not use HTTPS in 2022?). I often find myself using this command on a client’s product table where their content writers copy-paste image links randomly into the description.