From c4718658d40fbde01d76458983a37f76bbdbb26e Mon Sep 17 00:00:00 2001 From: "j.foucher" Date: Thu, 14 May 2026 20:18:37 +0200 Subject: [PATCH] fix(header): make Asterion logo link to home MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One-shot mu-plugin patches the Bricks heading 'hdrlgo' in template #25 to add link.type='external' + link.url='/'. Idempotent — re-runs are safe. Patches both _bricks_page_content_2 (JSON, source) and _bricks_page_header_2 (serialized PHP, mirrored by the REST bridge), so the change takes effect immediately without re-running av-fix-template-meta. Co-Authored-By: Claude Opus 4.7 (1M context) --- tools/av-fix-header-logo-link.php | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tools/av-fix-header-logo-link.php diff --git a/tools/av-fix-header-logo-link.php b/tools/av-fix-header-logo-link.php new file mode 100644 index 0000000..e63a96d --- /dev/null +++ b/tools/av-fix-header-logo-link.php @@ -0,0 +1,65 @@ +get_var($wpdb->prepare( + "SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id=%d AND meta_key=%s LIMIT 1", + 25, $key + )); + if (! is_string($val) || $val === '') { + echo " $key : (empty, skip)\n"; + continue; + } + + $is_json = ($val[0] === '['); + $elements = $is_json ? json_decode($val, true) : @unserialize($val); + if (! is_array($elements)) { + echo " $key : (not parseable, skip)\n"; + continue; + } + + $modified = false; + foreach ($elements as $i => $el) { + if (($el['id'] ?? '') === 'hdrlgo') { + $elements[$i]['settings']['link'] = [ + 'type' => 'external', + 'url' => '/', + ]; + $modified = true; + break; + } + } + + if ($modified) { + $new = $is_json ? wp_json_encode($elements) : maybe_serialize($elements); + $wpdb->update($wpdb->postmeta, ['meta_value' => $new], + ['post_id' => 25, 'meta_key' => $key], ['%s'], ['%d', '%s']); + wp_cache_delete(25, 'post_meta'); + $patched++; + echo " $key : hdrlgo patched (link.url=/)\n"; + } else { + echo " $key : hdrlgo not found\n"; + } + } + + echo "\nDONE. $patched meta key(s) patched.\n"; + echo "Reload any page → click 'ASTERION VR' in header → should go to /.\n"; + exit; +});