WPSEO_Slug_Change_Watcher::get_post_type_label()protectedYoast 1.0

Retrieves the singular post type label.

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

Хуков нет.

Возвращает

Строку. The singular post type name.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_post_type_label( $post_type );
$post_type(строка) (обязательный)
Post type to retrieve label from.

Код WPSEO_Slug_Change_Watcher::get_post_type_label() Yoast 22.4

protected function get_post_type_label( $post_type ) {
	$post_type_object = get_post_type_object( $post_type );

	// If the post type of this post wasn't registered default back to post.
	if ( $post_type_object === null ) {
		$post_type_object = get_post_type_object( 'post' );
	}

	return $post_type_object->labels->singular_name;
}