Trade With Viet
Session Explainer
Internal use only — enter access password
setup

TWV WordPress, mapped — structure plus the rules that stop the same bugs recurring

2026-06-12 · explainer.tradewithviet.com

We turned scattered TWV WordPress know-how into one canonical doc, an enforced pre-edit safety gate, and this explainer.Gom kiến thức WordPress của TWV (đang rải rác) thành một tài liệu chuẩn, một 'cửa an toàn' bắt buộc đọc trước khi sửa, và bản giải thích này.

The site's structure and hard-won bug lessons lived in chat memory and Python scripts, so the same bugs kept returning. They now live in docs/wordpress-operations.md (structure) and docs/wordpress-safety-rules.md (non-negotiable rules), ported from BEUP and adapted to TWV's real edit surfaces and 3-layer cache.Cấu trúc site và các bài học sửa lỗi từng nằm trong bộ nhớ chat và script Python, nên lỗi cũ cứ lặp lại. Giờ chúng nằm ở docs/wordpress-operations.md (cấu trúc) và docs/wordpress-safety-rules.md (luật bắt buộc), lấy từ BEUP và chỉnh theo đúng 'bề mặt sửa' và cache 3 lớp của TWV.

Scopetradewithviet.com (WordPress)Output2 docs + memory + AGENTS gateStatusCommitted to repoDate2026-06-12

6-layer thinking chainChuỗi tư duy 6 tầng

L1
Raw requestYêu cầu gốc
hãy khám phá cấu trúc toàn trang, elementor, css, snippet, php, rules, principles, có thể học từ beup explainer liên quan đến wordpress principles khi fix bug, rồi tạo 1 explainer riêng cho tradewithviet — lưu ý cả vietconnect.
L2
Reframe — what was really neededDiễn giải lại — nhu cầu thật
The real ask is not 'one HTML page.' It is: capture how TWV's WordPress is actually built, and the principles for fixing it safely — the same body of knowledge BEUP already matured — so future sessions stop repeating bugs. The explainer is the shareable surface; the durable docs are the point.Yêu cầu thật không phải 'một trang HTML'. Mà là: ghi lại WordPress của TWV được dựng thế nào, và nguyên tắc sửa an toàn — đúng khối kiến thức BEUP đã có — để các phiên sau ngừng lặp lỗi. Explainer là bề mặt chia sẻ; tài liệu bền mới là cốt lõi.
L3
ConstraintsRàng buộc
Constraints discovered: (1) TWV is NOT snippet-centric like BEUP — design lives in Customizer CSS post 6737 + Elementor kit post 6390 + mu-plugins, with only 3 active snippets (API proxies). (2) TWV has 3 page caches (LiteSpeed + WP-Optimize + Autoptimize), not BEUP's 1. (3) Different SSH host/user. So BEUP rules must be adapted, not copied. (4) VietConnect is a Next.js app, not WordPress — its rule is the content boundary, not snippet hygiene.Ràng buộc phát hiện: (1) TWV KHÔNG lấy snippet làm trung tâm như BEUP — thiết kế nằm ở Customizer CSS post 6737 + Elementor kit post 6390 + mu-plugins, chỉ 3 snippet đang bật (proxy API). (2) TWV có 3 lớp cache (LiteSpeed + WP-Optimize + Autoptimize), không phải 1 như BEUP. (3) SSH host/user khác. Nên luật BEUP phải chỉnh lại, không copy. (4) VietConnect là app Next.js, không phải WordPress — luật của nó là ranh giới nội dung, không phải vệ sinh snippet.
L4
Options weighedCác lựa chọn cân nhắc
Options: (a) HTML explainer only — shareable but not version-controlled, not loaded into future context. (b) Repo docs only — durable but not browsable. (c) Both + wire the rules into AGENTS.md and memory so a session must read them before editing. (d) Copy BEUP's docs verbatim — fast but wrong, since the surfaces differ.Phương án: (a) Chỉ HTML — chia sẻ được nhưng không version, không tự nạp vào ngữ cảnh sau. (b) Chỉ tài liệu repo — bền nhưng không duyệt web được. (c) Cả hai + gắn luật vào AGENTS.md và memory để phiên sau buộc phải đọc trước khi sửa. (d) Copy nguyên tài liệu BEUP — nhanh nhưng sai vì bề mặt khác nhau.
L5
Principle invokedNguyên tắc áp dụng
A guardrail only works if it is loaded before the dangerous action, not filed somewhere after it.
L6
Pick + recognition signalLựa chọn + dấu hiệu nhận biết
Picked (c) + adapted-not-copied. Two repo docs, plus an AGENTS.md pointer and a memory file so the safety rules surface BEFORE any WP edit. Rejected HTML-only (no enforcement) and verbatim-copy (wrong cache count, wrong edit surfaces). Recognition signal: next time knowledge lives only in chat memory and a bug recurs, promote it to a version-controlled doc AND wire it into the pre-action gate.Chọn (c) + chỉnh-không-copy. Hai tài liệu repo, cộng con trỏ trong AGENTS.md và file memory để luật an toàn hiện ra TRƯỚC khi sửa WP. Bỏ phương án chỉ-HTML (không ép buộc) và copy-nguyên (sai số lớp cache, sai bề mặt sửa). Tín hiệu nhận biết: lần sau kiến thức chỉ nằm trong chat mà lỗi lặp lại, hãy đưa nó thành tài liệu có version VÀ gắn vào cửa-trước-hành-động.

Four hosts, one content owner — and the three ways to edit the siteBốn host, một chủ nội dung — và ba cách sửa site

WordPress owns editorial truth; everything else points to it. Inside WordPress, you change things through three surfaces, not one — and a 3-layer cache sits in front of all of them.WordPress giữ 'sự thật' nội dung; mọi thứ khác trỏ về nó. Bên trong WordPress, bạn sửa qua ba bề mặt, không phải một — và cache 3 lớp đứng trước tất cả.

tradewithviet.comWordPress (canonical)vietconnect.Next.js app (Vercel)tools. / explainer.checker / this pagelinks out to /resources/ (one-way)3 edit surfaces inside WordPressGlobal lookElementor kit 6390Site-wide CSSCustomizer CSS 6737Structure / behaviourmu-plugins3-layer cache in front of everythingLiteSpeed + WP-Optimize + Autoptimize -> purge all 3 after every edit
Technical termThuật ngữ kỹ thuậtPlain nameTên dễ hiểuRoleVai trò
Elementor kit (post 6390)Global lookColors + typography for the whole site. Back up to /tmp first, then clear the Elementor files cache.Màu + font cho toàn site. Sao lưu ra /tmp trước, rồi xóa cache file Elementor.
Customizer Additional CSS (post 6737)Site-wide CSSButtons, links, dark sections, header/footer, the Metform fix. One consolidated stylesheet — back up its current value before overwriting.Nút, link, mục nền tối, header/footer, fix Metform. Một stylesheet gộp — sao lưu giá trị hiện tại trước khi ghi đè.
mu-pluginsStructure & behaviourtwv-resource-library (the /resources/ grid), twv-article-style, twv-toc, twv-seo-schema. Edit these, not Elementor, for those features.twv-resource-library (lưới /resources/), twv-article-style, twv-toc, twv-seo-schema. Sửa các file này, không phải Elementor.
3-layer cacheWhat hides your changeLiteSpeed + WP-Optimize + Autoptimize. Purge all three after every edit or the page stays stale; a 7-day browser cache sits on top.LiteSpeed + WP-Optimize + Autoptimize. Xóa cả ba sau mỗi lần sửa, không thì trang vẫn cũ; trên cùng còn cache trình duyệt 7 ngày.

Read it in 30 seconds: the app and the subdomains all point back to WordPress for content; inside WordPress you change one of three surfaces; then you must purge all three caches to actually see it.

Lesson to carry forward: when a change "doesn't show," the default suspect is the cache layer you forgot, not your edit.

Layered decision cardsCác quyết định theo tầng

Enforce the rules, don't just document themBắt buộc luật, không chỉ ghi tài liệu
L1Should the WP principles be a reference, or a gate?
L2A reference that nobody opens before editing prevents nothing.Tài liệu mà không ai mở trước khi sửa thì không ngăn được gì.
L3Future sessions read AGENTS.md and docs/INDEX.md by default; memory surfaces cross-session.Phiên sau mặc định đọc AGENTS.md và docs/INDEX.md; memory hiện ra xuyên phiên.
L4Reference-only / enforce via AGENTS pointer / enforce via memory / both.Chỉ tham khảo / ép qua con trỏ AGENTS / ép qua memory / cả hai.
L5Put the guardrail on the path the actor already walks.Đặt rào chắn ngay trên lối mà người làm vốn đã đi qua.
L6Both: AGENTS.md pointer + a memory file. Rejected reference-only — no enforcement.Cả hai: con trỏ AGENTS.md + file memory. Bỏ chỉ-tham-khảo — không ép buộc.
Adapt BEUP's rules, don't copy themChỉnh luật BEUP, không copy
L1BEUP already has admin-safety-rules.md — reuse it?BEUP đã có admin-safety-rules.md — tái dùng?
L2Same philosophy, different machine. Copying wrong specifics is worse than nothing.Cùng triết lý, khác máy. Copy chi tiết sai còn tệ hơn không có.
L3Live audit: TWV = 3 active snippets, design in Customizer/kit, 3 cache layers. BEUP = snippet-centric, 1 cache.Kiểm tra trực tiếp: TWV = 3 snippet, thiết kế ở Customizer/kit, 3 lớp cache. BEUP = lấy snippet làm trung tâm, 1 cache.
L4Verbatim copy / cite BEUP and link / rewrite for TWV's surfaces.Copy nguyên / dẫn link BEUP / viết lại theo bề mặt TWV.
L5Port the principle, re-derive the specifics from the live system.Mang nguyên lý sang, suy lại chi tiết từ hệ thống thật.
L6Kept the portable rules (never-PUT, .archive ban, verify-from-DB); rewrote cache + edit-surface sections from a live WP-CLI audit.Giữ luật mang được (never-PUT, cấm .archive, verify-from-DB); viết lại phần cache + bề mặt sửa từ kiểm tra WP-CLI thật.
Why a 3-layer purge is non-optionalVì sao purge 3 lớp là bắt buộc
L1Changes kept 'not showing' on /resources/.Thay đổi cứ 'không hiện' trên /resources/.
L2Two independent page caches serve HTML; purging one leaves the other stale.Hai cache trang độc lập phục vụ HTML; xóa một cái thì cái kia vẫn cũ.
L3LiteSpeed + WP-Optimize (disk wpo-cache) + Autoptimize all present and active.LiteSpeed + WP-Optimize (wpo-cache trên đĩa) + Autoptimize đều có và đang bật.
L4Purge LiteSpeed only / purge two / purge all + rm the wpo-cache dir.Chỉ xóa LiteSpeed / xóa hai / xóa hết + rm thư mục wpo-cache.
L5If two systems can serve the page, you are not done until both are cleared.Nếu hai hệ thống có thể phục vụ trang, chưa xong cho tới khi xóa cả hai.
L6Documented the exact 4-command sequence; flagged Autoptimize js_defer_inline must stay OFF.Ghi đúng chuỗi 4 lệnh; cảnh báo Autoptimize js_defer_inline phải TẮT.

Artifact mapBản đồ tệp tạo ra

PathĐường dẫnWhatLà gìWho reads itAi dùng
docs/wordpress-operations.mdDurable knowledge doc: topology, access, structure, design system, edit-surface map, VietConnect boundaryTài liệu kiến thức bền: topology, truy cập, cấu trúc, design system, bản đồ bề mặt sửa, ranh giới VietConnectAny session touching the TWV WordPress site
docs/wordpress-safety-rules.mdNon-negotiable pre-edit guardrails: 3-layer purge, snippet/CSS/Elementor rules, Playwright QARào chắn bắt buộc trước khi sửa: purge 3 lớp, luật snippet/CSS/Elementor, QA PlaywrightRead first before any live WP edit
docs/INDEX.mdAdded routing rows + task router entry for the two new docsThêm dòng định tuyến + router tác vụ cho hai tài liệu mớiDoc discovery
docs/decisions.mdAppended the 2026-06-12 decision: WP knowledge canonical + safety rules as a gateThêm quyết định 2026-06-12: kiến thức WP chuẩn + luật an toàn làm cửaDecision log
AGENTS.mdAdded a 'read safety rules before editing TWV WP' pointer blockThêm khối con trỏ 'đọc luật an toàn trước khi sửa WP TWV'Project instructions, loaded every session
memory/project_twv_wordpress_safety.mdCross-session recall of the guardrail + MEMORY.md index lineGợi nhớ xuyên phiên về rào chắn + dòng index trong MEMORY.mdFuture sessions, even outside this repo

Check your understandingKiểm tra hiểu biết

Why must you purge LiteSpeed AND WP-Optimize AND Autoptimize after an edit, not just LiteSpeed?Vì sao phải xóa LiteSpeed VÀ WP-Optimize VÀ Autoptimize sau khi sửa, không chỉ LiteSpeed?
On TWV, the dark strips behind contact-form labels were caused by what?Trên TWV, các dải tối sau nhãn form liên hệ do đâu?
In your own words: why is WordPress the SEO canonical for blog posts, and not the Next.js app?Tự diễn đạt: vì sao WordPress là canonical SEO cho bài blog, không phải app Next.js?
Mastery checklist — tick what you can explain unpromptedBảng tự đánh giá — tích những gì bạn tự giải thích được