pre_delete_post хук-фильтрWP 4.4.0

Filters whether a post deletion should take place.

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

add_filter( 'pre_delete_post', 'wp_kama_pre_delete_post_filter', 10, 3 );

/**
 * Function for `pre_delete_post` filter-hook.
 * 
 * @param WP_Post|false|null $delete       Whether to go forward with deletion. @TODO description
 * @param WP_Post            $post         Post object.
 * @param bool               $force_delete Whether to bypass the Trash.
 *
 * @return WP_Post|false|null
 */
function wp_kama_pre_delete_post_filter( $delete, $post, $force_delete ){

	// filter...
	return $delete;
}
$delete(WP_Post|false|null)
Whether to go forward with deletion. @TODO description
$post(WP_Post)
Post object.
$force_delete(true|false)
Whether to bypass the Trash.

Список изменений

С версии 4.4.0 Введена.

Где вызывается хук

wp_delete_post()
pre_delete_post
wp-includes/post.php 3375
$check = apply_filters( 'pre_delete_post', null, $post, $force_delete );

Где используется хук в WordPress

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