Tribe_Meta_Box::delete_file()
Source
File: lib/tribe-meta-box.php
public function delete_file() {
if ( ! isset( $_POST['data'] ) ) {
die();
}
list( $nonce, $post_id, $key, $attach_id ) = explode( '|', $_POST['data'] );
if ( ! wp_verify_nonce( $nonce, 'tribe_ajax_delete' ) ) {
die( '1' );
}
$post = get_post( $post_id );
if ( ! $post instanceof WP_Post ) {
die( '1' );
}
$cap = get_post_type_object( $post->post_type )->cap->edit_post;
// Check if the user can edit the post by ID
if ( ! current_user_can( $cap, $post->ID ) ) {
die( '1' );
}
delete_post_meta( $post_id, $key, $attach_id );
die( '0' );
}