Yoast\WP\SEO\Services\Importing\Aioseo

Aioseo_Robots_Provider_Service::get_global_robot_settings()publicYoast 1.0

Retrieves the robot setting set globally in AIOSEO.

{} Это метод класса: Aioseo_Robots_Provider_Service{}

Хуков нет.

Возвращает

true|false. Whether global robot settings enable or not the specific setting.

Использование

$Aioseo_Robots_Provider_Service = new Aioseo_Robots_Provider_Service();
$Aioseo_Robots_Provider_Service->get_global_robot_settings( $setting_name );
$setting_name(строка) (обязательный)
The name of the robot setting, eg. noindex.

Код Aioseo_Robots_Provider_Service::get_global_robot_settings() Yoast 19.2

public function get_global_robot_settings( $setting_name ) {
	$aioseo_settings = $this->aioseo_helper->get_global_option();
	if ( empty( $aioseo_settings ) ) {
		return false;
	}

	$global_robot_settings = $aioseo_settings['searchAppearance']['advanced']['globalRobotsMeta'];
	if ( $global_robot_settings['default'] === true ) {
		return false;
	}

	return $global_robot_settings[ $setting_name ];
}