Ecommerce Shopify WordPress Discussion

WordPress database update post meta

I have an Excel file containing the names of my pages and posts. I inquired with ChatGPT about the SQL queries for: -Updating the ALT of the images UPDATE wp_postmeta SET meta_value = CASE WHEN post_id = 'ID1' AND meta_key = '_wp_attachment_image_alt' THEN 'new_alt_text1' WHEN post_id = 'ID2' AND meta_key = '_wp_attachment_image_alt' THEN 'new_alt_text2' -- Add other conditions for each ID and alt text END WHERE post_id IN ('ID1', 'ID2', 'ID3', ...) AND meta_key = '_wp_attachment_image_alt'; -Updating posts informations: UPDATE wp_posts SET post_date = CASE WHEN ID = 'ID1' THEN 'new_date1' WHEN ID = 'ID2' THEN 'new_date2' -- Add other conditions for each ID and new date END, post_modified = CASE WHEN ID = 'ID1' THEN 'new_date_modified1' WHEN ID = 'ID2' THEN 'new_date_modified2' -- Add other conditions for each ID and new modified date END, post_title = CASE WHEN ID = 'ID1' THEN 'new_title1' WHEN ID = 'ID2' THEN 'new_title2' -- Add other conditions for each ID and new title END WHERE ID IN ('ID1', 'ID2', 'ID3', ...); -Updating the Yoast SEO meta UPDATE wp_postmeta SET meta_value = CASE WHEN post_id = 'ID1' AND meta_key = '_yoast_wpseo_canonical' THEN 'new_canonical_url1' WHEN post_id = 'ID2' AND meta_key = '_yoast_wpseo_canonical' THEN 'new_canonical_url2' -- Add other conditions for each ID of canonical URL WHEN post_id = 'ID3' AND meta_key = '_yoast_wpseo_metadesc' THEN 'new_meta_description3' WHEN post_id = 'ID4' AND meta_key = '_yoast_wpseo_metadesc' THEN 'new_meta_description4' -- Add other conditions for each ID of meta-description END WHERE (post_id = 'ID1' AND meta_key = '_yoast_wpseo_canonical') OR (post_id = 'ID2' AND meta_key = '_yoast_wpseo_canonical') OR (post_id = 'ID3' AND meta_key = '_yoast_wpseo_metadesc') OR (post_id = 'ID4' AND meta_key = '_yoast_wpseo_metadesc'); Can you confirm that these query will work to update the informations I asked on Pages and Posts ? Thank you
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.