WPSEO_Slug_Change_Watcher::is_term_viewable()protectedYoast 1.0

Checks if the term is viewable.

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

Хуков нет.

Возвращает

true|false. Whether the term is viewable or not.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->is_term_viewable( $term_taxonomy_id );
$term_taxonomy_id(int) (обязательный)
The term taxonomy ID to check.

Код WPSEO_Slug_Change_Watcher::is_term_viewable() Yoast 22.4

protected function is_term_viewable( $term_taxonomy_id ) {
	$term = get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );

	if ( ! $term || is_wp_error( $term ) ) {
		return false;
	}

	$taxonomy = get_taxonomy( $term->taxonomy );
	if ( ! $taxonomy ) {
		return false;
	}

	return $taxonomy->publicly_queryable || $taxonomy->public;
}