protected function delete_callback( $post_id, $assoc_args ) {
		$status    = get_post_status( $post_id );
		$post_type = get_post_type( $post_id );

		if ( ! $assoc_args['force']
			&& ( 'post' !== $post_type && 'page' !== $post_type ) ) {
			return [
				'error',
				"Posts of type '{$post_type}' do not support being sent to trash.\n"
				. 'Please use the --force flag to skip trash and delete them permanently.',
			];
		}

		if ( ! wp_delete_post( $post_id, $assoc_args['force'] ) ) {
			return [ 'error', "Failed deleting post {$post_id}." ];
		}

		$action = $assoc_args['force'] || 'trash' === $status || 'revision' === $post_type ? 'Deleted' : 'Trashed';

		return [ 'success', "{$action} post {$post_id}." ];
	}
protected function delete_callback( $post_id, $assoc_args ) {
		$status    = get_post_status( $post_id );
		$post_type = get_post_type( $post_id );

		if ( ! $assoc_args['force']
			&& ( 'post' !== $post_type && 'page' !== $post_type ) ) {
			return [
				'error',
				"Posts of type '{$post_type}' do not support being sent to trash.\n"
				. 'Please use the --force flag to skip trash and delete them permanently.',
			];
		}

		if ( ! wp_delete_post( $post_id, $assoc_args['force'] ) ) {
			return [ 'error', "Failed deleting post {$post_id}." ];
		}

		$action = $assoc_args['force'] || 'trash' === $status || 'revision' === $post_type ? 'Deleted' : 'Trashed';

		return [ 'success', "{$action} post {$post_id}." ];
	}
protected function delete_callback ( $ post_id , $ assoc_args ) { $ status = get_post_status ( $ post_id ) ; $ post_type = get_post_type ( $ post_id ) ; if ( ! $ assoc_args [ 'force' ] && ( 'post' !== $ post_type && 'page' !== $ post_type ) ) { return [ 'error' , "Posts of type '{$post_type}' do not support being sent to trash.\n" . 'Please use the --force flag to skip trash and delete them permanently.' , ] ; } if ( ! wp_delete_post ( $ post_id , $ assoc_args [ 'force' ] ) ) { return [ 'error' , "Failed deleting post {$post_id}." ] ; } $ action = $ assoc_args [ 'force' ] || 'trash' === $ status || 'revision' === $ post_type ? 'Deleted' : 'Trashed' ; return [ 'success' , "{$action} post {$post_id}." ] ; }
Callback used to delete a post.

@param $post_id
@param $assoc_args
@return array
Callback used to delete a post .