bp_media_delete_attachment_media( int $attachment_id )
Delete media entries attached to the attachment
Description
Parameters
- $attachment_id
-
(Required) ID of the attachment being deleted.
Source
File: bp-media/bp-media-filters.php
function bp_media_delete_attachment_media( $attachment_id ) { global $wpdb; $bp = buddypress(); $media = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->media->table_name} WHERE attachment_id = %d", $attachment_id ) ); if ( ! $media ) { return false; } remove_action( 'delete_attachment', 'bp_media_delete_attachment_media', 0 ); bp_media_delete( array( 'id' => $media->id ), 'attachment' ); add_action( 'delete_attachment', 'bp_media_delete_attachment_media', 0 ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.2.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.