Yoast\WP\SEO\Abilities\Application
Llms_Txt_Status_Updater::set_status
Enables or disables the llms.txt feature and returns its new status.
Enabling generates the file synchronously through the option watcher, which can fail without the option write failing. Like the admin notification, a recorded failure is only reported while the feature is enabled, as a warning rather than an error.
Метод класса: Llms_Txt_Status_Updater{}
Хуков нет.
Возвращает
array<string, bool|string>|WP_Error. The new status, or an error when the input is invalid or the status could not be saved.
Использование
$Llms_Txt_Status_Updater = new Llms_Txt_Status_Updater(); $Llms_Txt_Status_Updater->set_status( $input );
- $input(array<string, bool>) (обязательный)
- The input holding the desired
enabledstatus.
Код Llms_Txt_Status_Updater::set_status() Llms Txt Status Updater::set status Yoast 28.8
public function set_status( array $input ) {
$was_enabled = ( $this->options_helper->get( self::OPTION_NAME, false ) === true );
$result = $this->feature_status_updater->set_status( self::OPTION_NAME, $input );
if ( ! \is_array( $result ) || $result['enabled'] !== true ) {
return $result;
}
// The option watcher only generates the file when the option actually changes. Enabling an
// already enabled feature is how an agent retries after fixing the cause of an earlier
// failure, so generate again to report a fresh outcome instead of the stored one.
if ( $was_enabled ) {
$this->populate_file_command_handler->handle();
}
$warning = $this->get_generation_failure_warning();
if ( $warning !== null ) {
$result['warning'] = $warning;
}
return $result;
}