WPSEO_Replace_Vars::retrieve_author_first_name()privateYoast 1.0

Retrieve the post/page/cpt author's first name for use as replacement string.

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

Хуков нет.

Возвращает

Строку|null.

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

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

Код WPSEO_Replace_Vars::retrieve_author_first_name() Yoast 22.3

private function retrieve_author_first_name() {
	$replacement = null;

	$user_id = (int) $this->retrieve_userid();
	$name    = get_the_author_meta( 'first_name', $user_id );
	if ( $name !== '' ) {
		$replacement = $name;
	}

	return $replacement;
}