wp_delete_attachment()代码实现通过id进行删除附件

目录

描述

This function deletes an attachment and all of its derivatives.

wp_delete_attachment() 描述

用法

 <?php wp_delete_attachment$attachmentid$force_delete ); ?> 

wp_delete_attachment() 用法

参数

$attachmentid

(integer) (必填) The ID of the attachment you would like to delete.

默认值: None

$force_delete

(bool) (可选) Whether to bypass trash and force deletion (added in WordPress 2.9).

默认值: false

wp_delete_attachment() 参数

返回值

Returns false on failure, post data on success. This should be checked using the identity operator ( === ) instead of the normal equality operator because of the possibility of a returned 0 or empty array:

wp_delete_attachment() 返回值

源文件

wp_delete_attachment() 函数的代码位于 wp-includes/post.php.

wp_delete_attachment() 源文件

相关