# thinkrank/2.3.0/includes/abilities/settings/class-get-robots-meta-settings.php

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

- Page: https://pluginprobe.com/plugins/thinkrank/2.3.0/code/includes/abilities/settings/class-get-robots-meta-settings.php
- Raw: https://pluginprobe.com/plugins/thinkrank/2.3.0/raw/includes/abilities/settings/class-get-robots-meta-settings.php
- Modified: 2026-08-31T10:09:34+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/2.3.0/code/includes/abilities/settings/class-get-robots-meta-settings.php#L10-L20`.

```php
<?php
/**
 * Get robots meta settings ability.
 *
 * @package ThinkRank\Abilities\Settings
 */

declare(strict_types=1);

namespace ThinkRank\Abilities\Settings;

use ThinkRank\Abilities\Ability_Base;

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

/**
 * Retrieves ThinkRank site-wide default robots meta settings.
 *
 * These flags form the base robots meta directives applied to the whole site,
 * before any post-type or per-post overrides.
 */
class Get_Robots_Meta_Settings extends Ability_Base {
	/**
	 * Option name that stores the global robots meta settings.
	 */
	private const OPTION = 'thinkrank_global_robot_meta_settings';

	/**
	 * Default robots meta directives.
	 */
	private const DEFAULTS = [
		'index'        => true,
		'noindex'      => false,
		'nofollow'     => false,
		'noarchive'    => false,
		'noimageindex' => false,
		'nosnippet'    => false,
	];

	/**
	 * Constructor.
	 */
	public function __construct() {
		$this->id          = 'thinkrank/get-robots-meta-settings';
		$this->label       = __( 'Get ThinkRank Robots Meta Settings', 'thinkrank' );
		$this->description = __( 'Retrieve ThinkRank site-wide default robots meta directives (index, noindex, nofollow, noarchive, noimageindex, nosnippet). Use update-robots-meta-settings to change them.', 'thinkrank' );
	}

	/**
	 * {@inheritDoc}
	 *
	 * @return array<string, bool|float|string>
	 */
	public function get_annotations() {
		return [
			'readonly'      => true,
			'destructive'   => false,
			'idempotent'    => true,
			'priority'      => 1.0,
			'openWorldHint' => false,
		];
	}

	/**
	 * {@inheritDoc}
	 *
	 * @return array<string, mixed>
	 */
	public function get_input_schema() {
		return [
			'type'                 => 'object',
			'additionalProperties' => false,
			'properties'           => self::empty_properties(),
		];
	}

	/**
	 * {@inheritDoc}
	 *
	 * @return array<string, mixed>
	 */
	public function get_output_schema() {
		return [
			'type'       => 'object',
			'properties' => [
				'index'        => [ 'type' => 'boolean' ],
				'noindex'      => [ 'type' => 'boolean' ],
				'nofollow'     => [ 'type' => 'boolean' ],
				'noarchive'    => [ 'type' => 'boolean' ],
				'noimageindex' => [ 'type' => 'boolean' ],
				'nosnippet'    => [ 'type' => 'boolean' ],
			],
		];
	}

	/**
	 * Execute ability.
	 *
	 * @param array<string, mixed> $input Ability input payload.
	 * @return array<string, mixed>
	 */
	public function execute( $input ) {
		$settings = wp_parse_args( (array) get_option( self::OPTION, [] ), self::DEFAULTS );

		$out = [];
		foreach ( array_keys( self::DEFAULTS ) as $key ) {
			$out[ $key ] = (bool) ( $settings[ $key ] ?? self::DEFAULTS[ $key ] );
		}

		return $out;
	}
}

```
