Ecommerce Shopify WordPress Discussion

Cannot update WP post title and slug via SQL

I try to replace 2023 to 2024 in WordPress post_title and post_name(slug), as below: UPDATE `wp_posts` SET post_title = REPLACE(post_title, '(2023)', '(2024)'), post_name = REPLACE(post_name, '-2023', '-2024') WHERE (post_title LIKE '%(2023)%') and (post_type = 'post'); However, after executing the query, although the data in the table are changed, in WP Dashboard, the title and slug of the post are not. Why? I have tried to clear the cache but do not work. Update: Finally I use WP Migrate's find & replace feature to replace all "(2023)" to "(2024)" in all wp tables, and it works.
It is working for me UPDATE `wp_posts` SET post_title = REPLACE(post_title, '2024', '2025'),post_name = REPLACE(post_name, '2024', '2025') WHERE post_type = 'post' AND (post_title LIKE '%2024%' OR post_name LIKE '%2024%'); This query should replace all occurrences of '2023' with '2024' in both the post_title and post_name columns for posts with the post type 'post'. The % in the LIKE condition allows for matching '2023' anywhere in the title or slug. I recommend utilizing the global $wpdb object with $wpdb->posts instead of directly referencing wp_posts

January 7, 2024

If you have not disabled revisions in WordPress you must also include the "revision" post_type in the query: ... AND ( post_type = 'post' OR post_type = 'revision' );

January 7, 2024

TurboCommerce make the better internet purchasing globaly

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

TurboCommerce make the better internet purchasing globaly
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.