From 1410cafa159cbbedaae8a7edb3b3734994c74b6e Mon Sep 17 00:00:00 2001 From: Joaquim d'Souza Date: Thu, 14 Dec 2023 16:42:12 +0100 Subject: [PATCH] feat: actually fix broken links --- web/app/themes/awasqa/src/import.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/app/themes/awasqa/src/import.php b/web/app/themes/awasqa/src/import.php index 7ff5fec..425dfdc 100644 --- a/web/app/themes/awasqa/src/import.php +++ b/web/app/themes/awasqa/src/import.php @@ -1277,12 +1277,17 @@ function fix_links() $new_path .= "?lang=$lang"; } } - echo "Replacing $url with $new_path\n"; + echo "Replacing in {$post->ID}: $url with $new_path\n"; $found = @file_get_contents($new_path); if (!$found) { echo "MISSING PAGE $url $new_path\n"; //exit(1); } + $content = str_replace($url, $new_path, $content); + wp_update_post([ + "ID" => $post->ID, + "post_content" => $content + ]); } } }