Yoast\WP\SEO\Helpers

Post_Helper::get_post_title_with_fallback()publicYoast 1.0

Retrieves the post title with fallback to No title.

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

Хуков нет.

Возвращает

Строку. The post title with fallback to No title.

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

$Post_Helper = new Post_Helper();
$Post_Helper->get_post_title_with_fallback( $post_id );
$post_id(int)
Post ID.

Код Post_Helper::get_post_title_with_fallback() Yoast 22.4

public function get_post_title_with_fallback( $post_id = 0 ) {
	$post_title = \get_the_title( $post_id );
	if ( $post_title ) {
		return $post_title;
	}

	return \__( 'No title', 'wordpress-seo' );
}