WPSEO_Replace_Vars::retrieve_excerpt_only()privateYoast 1.0

Retrieve the post/page/cpt excerpt for use as replacement string (without auto-generation).

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

Хуков нет.

Возвращает

Строку|null.

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

// private - только в коде основоного (родительского) класса
$result = $this->retrieve_excerpt_only();

Код WPSEO_Replace_Vars::retrieve_excerpt_only() Yoast 22.4

private function retrieve_excerpt_only() {
	$replacement = null;

	// The check `post_password_required` is because excerpt must be hidden for a post with a password.
	if ( ! empty( $this->args->ID ) && $this->args->post_excerpt !== '' && ! post_password_required( $this->args->ID ) ) {
		$replacement = wp_strip_all_tags( $this->args->post_excerpt );
	}

	return $replacement;
}