Yoast\WP\SEO\Generators\Schema

Author::determine_user_id()protectedYoast 1.0

Determines a User ID for the Person data.

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

Хуки из метода

Возвращает

true|false|int. User ID or false upon return.

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

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

Код Author::determine_user_id() Yoast 22.4

protected function determine_user_id() {
	$user_id = 0;

	if ( $this->context->indexable->object_type === 'post' ) {
		$user_id = (int) $this->context->post->post_author;
	}

	if ( $this->context->indexable->object_type === 'user' ) {
		$user_id = $this->context->indexable->object_id;
	}

	/**
	 * Filter: 'wpseo_schema_person_user_id' - Allows filtering of user ID used for person output.
	 *
	 * @param int|bool $user_id The user ID currently determined.
	 */
	$user_id = \apply_filters( 'wpseo_schema_person_user_id', $user_id );

	if ( \is_int( $user_id ) && $user_id > 0 ) {
		return $user_id;
	}

	return false;
}