Codex

Function Reference/wp delete attachment

Contents

Description

This function deletes an attachment

Usage

 <?php wp_delete_attachment$postid ); ?> 

Example

To delete an attachment with an ID of '76':

<?php wp_delete_attachment( 76 ); ?>

Parameters

$postid
(integer) (required) The ID of the attachment you would like to delete.
Default: None

Hooks

This function fires the delete_attachment action hook, passing the attachment's ID ($postid).

Related

wp_get_attachment_url()

delete_attachment

This page is marked as incomplete. You can help Codex by expanding it.