我正在尋找一種如何使用 Wordpress php 腳本執(zhí)行多個 sql 任務(wù)的方法。到目前為止,我有以下功能,但它不會執(zhí)行所有任務(wù)。private function rename_products($product) { global $wpdb; // Replace product names and descriptions $sql = "UPDATE wp_posts SET post_title = REPLACE(post_title, 'Velikost Osu?ka', 'Osu?ka, Velikost');"; $sql = "UPDATE wp_posts SET post_title = REPLACE(post_title, 'Velikost Ru?ník 50x100Velikost Ru?ník 50 x 100', 'Ru?ník, Velikost 50x100');"; $sql = "UPDATE wp_posts SET post_content = REPLACE(post_content, 'Velikost Ru?ník 50x100Velikost Ru?ník 50 x 100', 'Ru?ník, Velikost 50x100');"; $sql = "UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, 'Velikost Ru?ník 50x100Velikost Ru?ník 50 x 100', 'Ru?ník, Velikost 50x100');"; $wpdb->query($sql);}有任何想法嗎?
如何在 php 中為 Wordpress 查詢多個 SQL 任務(wù)?
幕布斯7119047
2021-12-03 19:48:23