# thinkrank/1.26.0/includes/abilities/analysis/class-generate-llms-txt.php

ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console &amp; Local SEO, version 1.26.0. 84 lines.

- Page: https://pluginprobe.com/plugins/thinkrank/1.26.0/code/includes/abilities/analysis/class-generate-llms-txt.php
- Raw: https://pluginprobe.com/plugins/thinkrank/1.26.0/raw/includes/abilities/analysis/class-generate-llms-txt.php
- Modified: 2026-07-14T13:48:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/thinkrank/1.26.0/code/includes/abilities/analysis/class-generate-llms-txt.php#L10-L20`.

```php
<?php
/**
 * Generate llms.txt preview ability.
 *
 * @package ThinkRank\Abilities\Analysis
 */

declare(strict_types=1);

namespace ThinkRank\Abilities\Analysis;

use ThinkRank\Abilities\Ability_Base;
use ThinkRank\SEO\LLMs_Txt_Manager;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Generates a preview of the llms.txt content without publishing it.
 *
 * This is a pure preview: it never writes the file to disk. Pass an empty
 * user_input object to preview using the currently saved settings.
 */
class Generate_Llms_Txt extends Ability_Base {
	/**
	 * Constructor.
	 */
	public function __construct() {
		$this->id          = 'thinkrank/generate-llms-txt';
		$this->label       = __( 'Generate ThinkRank llms.txt Preview', 'thinkrank' );
		$this->description = __( 'Generate a preview of the llms.txt content without publishing it to disk. Pass an empty user_input object to preview using the currently saved settings.', 'thinkrank' );
	}

	/**
	 * {@inheritDoc}
	 *
	 * @return array<string, mixed>
	 */
	public function get_input_schema() {
		return [
			'type'                 => 'object',
			'additionalProperties' => false,
			'properties'           => [
				'user_input' => [
					'type'        => 'object',
					'description' => __( 'Optional override values for the preview. When empty, saved settings are used.', 'thinkrank' ),
				],
			],
		];
	}

	/**
	 * {@inheritDoc}
	 *
	 * @return array<string, mixed>
	 */
	public function get_output_schema() {
		return [
			'type'       => 'object',
			'properties' => [
				'content'    => [ 'type' => 'string' ],
				'sections'   => [ 'type' => [ 'array', 'object' ] ],
				'metadata'   => [ 'type' => 'object' ],
				'validation' => [ 'type' => [ 'array', 'object' ] ],
			],
		];
	}

	/**
	 * Execute ability.
	 *
	 * @param array<string, mixed> $input Ability input payload.
	 * @return array<string, mixed>
	 */
	public function execute( $input ) {
		$user_input = isset( $input['user_input'] ) && is_array( $input['user_input'] ) ? $input['user_input'] : [];

		$manager = new LLMs_Txt_Manager();

		return $manager->generate_llms_txt( $user_input, [] );
	}
}

```
