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
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand