Yoast\WP\SEO\Helpers\Schema

Replace_Vars_Helper::register_replace_vars()publicYoast 1.0

Registers the Schema-related replace vars.

Метод класса: Replace_Vars_Helper{}

Хуков нет.

Возвращает

null. Ничего (null).

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

$Replace_Vars_Helper = new Replace_Vars_Helper();
$Replace_Vars_Helper->register_replace_vars( $context );
$context(Meta_Tags_Context) (обязательный)
The meta tags context.

Код Replace_Vars_Helper::register_replace_vars() Yoast 22.4

public function register_replace_vars( $context ) {
	$replace_vars = [
		'main_schema_id'   => $context->main_schema_id,
		'author_id'        => $this->id_helper->get_user_schema_id( $context->indexable->author_id, $context ),
		'person_id'        => $context->site_url . Schema_IDs::PERSON_HASH,
		'primary_image_id' => $context->canonical . Schema_IDs::PRIMARY_IMAGE_HASH,
		'webpage_id'       => $context->main_schema_id,
		'website_id'       => $context->site_url . Schema_IDs::WEBSITE_HASH,
		'organization_id'  => $context->site_url . Schema_IDs::ORGANIZATION_HASH,
	];

	if ( $context->post ) {
		// Post does not always exist, e.g. on term pages.
		$replace_vars['post_date'] = $this->date_helper->format( $context->post->post_date, \DATE_ATOM );
	}

	foreach ( $replace_vars as $var => $value ) {
		$this->register_replacement( $var, $value );
	}
}