WPSEO_Slug_Change_Watcher::detect_post_delete()
Shows a message when a post is about to get trashed.
Метод класса: WPSEO_Slug_Change_Watcher{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WPSEO_Slug_Change_Watcher = new WPSEO_Slug_Change_Watcher(); $WPSEO_Slug_Change_Watcher->detect_post_delete( $post_id );
- $post_id(int) (обязательный)
- The current post ID.
Код WPSEO_Slug_Change_Watcher::detect_post_delete() WPSEO Slug Change Watcher::detect post delete Yoast 24.0
public function detect_post_delete( $post_id ) { if ( ! $this->is_post_viewable( $post_id ) ) { return; } $post_label = $this->get_post_type_label( get_post_type( $post_id ) ); /* translators: %1$s expands to the translated name of the post type. */ $first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $post_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 ); }