3 步驟安裝教學
- 1
在 Dashboard → API Keys 產生一把 key
登入 AEO Pro,到 /dashboard/settings/api-keys 點「Generate new key」。複製 aeopro_ 開頭的字串,下一步會用到。Free 方案每小時 100 次呼叫額度,足夠單一 WordPress 站全站掃描。
- 2
把片段貼到主題的 functions.php(或 mu-plugin)
貼進去後存檔,WordPress 會在每一個文章 + 頁面的 <head> 自動注入 AEO Pro 產生的 Article / FAQPage / BreadcrumbList JSON-LD。注意:建議放到 mu-plugins 目錄,主題更新時不會被覆蓋。
範例程式碼php · mu-plugin<?php /** * Plugin Name: AEO Pro Schema Injector * Description: Injects Article / FAQPage / BreadcrumbList JSON-LD via AEO Pro REST API. */ if (!defined('ABSPATH')) exit; add_action('wp_head', function () { if (!is_singular()) return; $cache_key = 'aeopro_schema_' . get_the_ID(); $cached = get_transient($cache_key); if ($cached === false) { $resp = wp_remote_post('https://www.aeo-pro.app/api/v1/schema/generate', [ 'headers' => [ 'Authorization' => 'Bearer ' . AEOPRO_API_KEY, // wp-config.php 'Content-Type' => 'application/json', ], 'body' => wp_json_encode([ 'url' => get_permalink(), 'types' => ['Article', 'FAQPage', 'BreadcrumbList'], ]), 'timeout' => 6, ]); if (is_wp_error($resp)) return; $cached = wp_remote_retrieve_body($resp); set_transient($cache_key, $cached, HOUR_IN_SECONDS); } echo $cached; }, 5); - 3
啟用 llms.txt 自動產生 + AI 爬蟲允許清單
在 wp-config.php 加上 AEOPRO_API_KEY 常數,然後到 AEO Pro Dashboard → Sites → Add Site 把網域加進去。AEO Pro 會自動產生 /llms.txt 與 robots.txt 建議規則,每次 dateModified 變動時 5 分鐘內同步。
範例程式碼wp-config.phpdefine('AEOPRO_API_KEY', 'aeopro_xxxxxxxxxxxxxxxxxxxxxxxxxxxx'); define('AEOPRO_AUTO_LLMS_TXT', true); define('AEOPRO_AUTO_ROBOTS_ALLOWLIST', true);
常見問題
- 需要 WooCommerce 嗎?
- 不需要。本整合適用任何 WordPress 安裝。WooCommerce 商家可額外啟用 Product schema 自動注入(在 Dashboard → Sites → WooCommerce 切換)。
- 會拖慢網站嗎?
- 不會。Schema 是用 HOUR_IN_SECONDS transient 快取的(每篇文章一份),對訪客頁面零外部呼叫。第一次寫入 transient 時的 API 呼叫超時 6 秒,超時自動跳過。
- 可以只在特定文章注入嗎?
- 可以。把 is_singular() 換成自訂條件,例如 has_category('aeo') 或 in_array(get_the_ID(), [123, 456])。
- Multisite 環境怎麼設定?
- 每個 site 各自申請一把 API key 並寫到該 site 的 wp-config 區塊。AEO Pro 後台支援把多個 site 群組成同一個 workspace 統一檢視分數。