Yoast SEO (WordPress) Integration
Auto-append your xpay agent-payment block to Yoast’s generated llms.txt without breaking Yoast’s auto-updates.
The problem
Yoast SEO (v27+) auto-generates llms.txt at your WordPress root. It’s regenerated every time you publish, edit, or delete a post.
If you edit that file directly via the WordPress media manager or FTP, WordPress saves it as a static file, which overrides Yoast’s auto-generated version. Yoast keeps regenerating in the background, but the static file wins — so your llms.txt freezes on the day you edited it.
This means a naive “paste the xpay block at the bottom” approach is incompatible with Yoast.
The fix
A small, single-file WordPress plugin that:
- Hooks into the same
save_post/deleted_postevents Yoast uses. - Runs a delayed append (~60s after the post change) so it always runs after Yoast finishes regenerating.
- Reads
llms.txt, strips any prior xpay block (using hidden markers), and appends a fresh copy at the end. - Idempotent — re-running never duplicates.
The xpay block is configurable in WP admin (Settings → xpay llms.txt), so you can paste any block you generate from your dashboard.
Setup
Download the plugin
- Installable ZIP:
xpay-yoast-llms-append.zip - Source for inspection:
xpay-yoast-llms-append.php(~150 lines, MIT)
Install in WordPress
In WP admin:
- Plugins → Add New → Upload Plugin
- Choose
xpay-yoast-llms-append.zip - Click Install Now, then Activate
Paste your xpay block
- Open your dashboard at Account Config → Discovery Files .
- Copy the xpay block from
llms.txtpreview (the## Agent Paymentssection onwards — anything you want appended to the end of Yoast’s file). - In WP admin: Settings → xpay llms.txt.
- Paste into the textarea, click Save block.
Run the append
- Immediate: Click Run append now on the same Settings page.
- Automatic: Publish or update any post — the plugin runs ~60 seconds later.
Verify
Visit https://your-domain.com/llms.txt. You should see:
- Yoast’s auto-generated content (your articles, pages, custom post types) at the top
- An
<!-- xpay:block:start -->marker - Your xpay agent-payment block
- An
<!-- xpay:block:end -->marker
How it works
You publish a post
↓
WordPress fires save_post
↓ (Yoast also listens here)
Yoast regenerates llms.txt → writes static file at WP root
↓
Plugin schedules a single WP-Cron event 60s in the future
↓
Cron fires → reads llms.txt → strips old xpay block (between markers)
→ appends fresh xpay block + markers
→ writes back atomicallyThe 60-second delay avoids racing Yoast’s file write. The marker-based strip-and-replace makes the operation idempotent — running it ten times produces the same file as running it once.
Safety guarantees
The plugin only operates if all of the following are true:
- The xpay block setting is non-empty
llms.txtexists at the resolved path (respects Yoast’swpseo_llmstxt_filesystem_pathfilter if you’ve set a custom location)- The file is writable
- The file contains the string
Yoast SEO— a guard so the plugin refuses to touch files Yoast didn’t generate
If any check fails, the plugin silently bails. It will never overwrite a non-Yoast llms.txt or destroy unrelated content.
Uninstall
Deactivating the plugin clears its scheduled cron events. Your llms.txt will retain whatever the last append produced — the next time Yoast regenerates (after a post change), the static file will be replaced with a fresh Yoast-only version, and the xpay block will be gone.
To remove the xpay block immediately:
- Deactivate the plugin
- Either edit/republish any post (forces Yoast to regenerate without the xpay block), or
- Delete
llms.txtat your WP root and let Yoast regenerate it on the next post save
This plugin only solves the discovery file half of the integration. To monetize agent traffic, you also need bot deflection — see your CDN-specific guide (Cloudflare, Fastly, Akamai) or contact onboarding for help with WordPress-only deflection setups.
Compatibility
- Yoast SEO: v27.0+
- WordPress: 6.0+
- PHP: 7.4+
- Hosting: any (works behind Cloudflare, Hostinger Cache, Ezoic JS-Integration, etc. — operates at the WordPress origin, before any CDN)
Source code
The plugin is a single PHP file, MIT-licensed. View or fork: files.xpay.sh/setup/plugins/xpay-yoast-llms-append.php