WPSEO_Slug_Change_Watcher::detect_term_delete()publicYoast 1.0

Shows a message when a term is about to get deleted.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$WPSEO_Slug_Change_Watcher = new WPSEO_Slug_Change_Watcher();
$WPSEO_Slug_Change_Watcher->detect_term_delete( $term_taxonomy_id );
$term_taxonomy_id(int) (обязательный)
The term taxonomy ID that will be deleted.

Код WPSEO_Slug_Change_Watcher::detect_term_delete() Yoast 22.4

public function detect_term_delete( $term_taxonomy_id ) {
	if ( ! $this->is_term_viewable( $term_taxonomy_id ) ) {
		return;
	}

	$term       = get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
	$term_label = $this->get_taxonomy_label_for_term( $term->term_id );

	/* translators: %1$s expands to the translated name of the term. */
	$first_sentence  = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $term_label );
	$second_sentence = __( 'Search engines and other websites can still send traffic to your deleted content.', 'wordpress-seo' );
	$message         = $this->get_message( $first_sentence, $second_sentence );

	$this->add_notification( $message );
}