AIOSEO LLMS Filters

Purpose

These filters can be used to filter the titles and descriptions that appear in the llms.txt and llms-full.txt files generated by All in One SEO.

These files are used by Large Language Models (LLMs) to understand and index your site content. Using these filters, you can customize how individual posts and taxonomy terms are represented in those files.

Available Filters

  • aioseo_llms_post_title
  • aioseo_llms_term_title
  • aioseo_llms_post_description
  • aioseo_llms_term_description

Common Arguments

All of the filters listed above receive 2 arguments:

  1. The value to filter
    • $title (string) for title filters
    • $description (string) for description filters
  2. The object
    • $post (WP_Post) for post-based filters
    • $term (WP_Term) for term-based filters

The object parameter can be used to apply conditional logic based on post ID, post type, taxonomy, term ID, metadata, etc.

aioseo_llms_post_title

Purpose

This filter can be used to filter the post title that appears in the llms.txt and llms-full.txt files.

Arguments (2)

  • $title (string) – The post title.
  • $post (WP_Post) – The post object.

Example code snippet

The code snippet below changes the LLMS title for a specific post.

aioseo_llms_term_title

Purpose

This filter can be used to filter the term title (taxonomy term name) that appears in the llms.txt and llms-full.txt files.

Arguments (2)

  • $title (string) – The term title.
  • $term (WP_Term) – The term object.

Example code snippet

The code snippet below prepends the taxonomy name to the term title.

aioseo_llms_post_description

Purpose

This filter can be used to filter the post description that appears in the llms.txt file.

The description is typically the meta description set in All in One SEO, or the post excerpt if no meta description is available.

Arguments (2)

  • $description (string) – The post description.
  • $post (WP_Post) – The post object.

Example code snippet

The code snippet below modifies the description for a specific post.

The code example below removes description for a specific post ID.

aioseo_llms_term_description

Purpose

This filter can be used to filter the term description that appears in the llms.txt file.

The description is typically the meta description set in All in One SEO, or the term description if no meta description is available.

Arguments (2)

  • $description (string) – The term description.
  • $term (WP_Term) – The term object.

Example code snippet

The code snippet below appends the post count to category descriptions.

Notes

  • Returning an empty string from a title filter will exclude that post or term from appearing in the LLMS files.
  • Returning an empty string from a description filter will omit the description.
  • The list of use cases above is not exhaustive.

Implementation

Need help using our code snippets? Checkout our documentation on “How do I use your API code examples?“.

We recommend using the WPCode plugin for safe and secure implementation. WPCode performs multiple sanitization tests before activating the snippets, ensuring the safety of your website.