Developer reference

Filters

FilterArgumentsUse
lh_ai_legibility_init_pluginbool $initReturn false to switch the plugin off without deactivating it.
lh_ai_legibility_markdown_enabledbool $enabled, WP_Post $postReturn false to stop serving Markdown for a post, or for a whole post type. Also keeps the post out of llms-full.txt and out of archive pages served as Markdown.
lh_ai_legibility_markdown_outputstring $markdown, WP_Post $postChange a post’s Markdown, without its front matter, both in a response to an Accept: text/markdown request and where the post appears in llms-full.txt.
lh_ai_legibility_archive_markdown_enabledbool $enabled, WP_Query $queryReturn false to stop serving an archive page, or all of them, as Markdown.
lh_ai_legibility_archive_item_summarystring $summary, WP_Post $postThe one-line summary after a post’s link on an archive page served as Markdown. By default its excerpt, only when one was written; empty for none.
lh_ai_legibility_llms_txt_outputstring $outputChange the final /llms.txt output.
lh_ai_legibility_llms_full_outputstring $outputChange the final /llms-full.txt output.
lh_ai_legibility_return_max_http_checksint $maxMost links the llms.txt abilities request over HTTP in one call, when asked to check every link. Default 25.

Identifiers

Each identifier is returned by a static method on LH_AI_Legibility_Llms_Txt and can be changed with the filter of the same name. Change them only before any llms.txt document exists, since existing documents and the stored option use the old values.

FilterDefaultWhat it names
lh_ai_legibility_return_post_typellms_txt_documentThe llms.txt document post type
lh_ai_legibility_return_index_query_varlh_llms_txtThe query variable behind /llms.txt
lh_ai_legibility_return_full_query_varlh_llms_full_txtThe query variable behind /llms-full.txt
lh_ai_legibility_return_document_option_namelh_ai_legibility_document_idThe option holding the site’s document ID

The section block is lh-ai-legibility/section (named llms-txt/section before 0.5.1). Its name is fixed in block.json and the editor script, so it is not filterable.

What is served as Markdown

Headers and caching

LiteSpeed

LiteSpeed’s page cache ignores Vary: Accept, so without help it would serve a cached Markdown version of a page to browsers, or a cached HTML page to Markdown requests. On a LiteSpeed server the plugin therefore adds this block to the top of the root .htaccess, which gives Markdown requests a cache of their own:

# BEGIN LH AI Legibility LiteSpeed Cache
<IfModule LiteSpeed>
RewriteEngine On
RewriteCond %{HTTP:Accept} text/markdown [NC]
RewriteRule ^ - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+ismarkdown]
</IfModule>
# END LH AI Legibility LiteSpeed Cache

If the site uses any other full-page cache, check that it varies on Accept. Either exclude /llms.txt and /llms-full.txt from it or make sure it clears when the llms.txt document is saved, otherwise edits will not show until the cached copy expires.