bp_media_delete( array|string $args = '', bool $from = false )

Delete media.

Description

Parameters

$args

(Optional) To delete specific media items, use $args = array( 'id' => $ids ); Otherwise, to use filters for item deletion, the argument format is the same as BP_Media::get(). See that method for a description.

Default value: ''

$from

(Optional) Context of deletion from. ex. attachment, activity etc.

Default value: false

Return

(bool|int) The ID of the media on success. False on error.

Source

File: bp-media/bp-media-functions.php

function bp_media_delete( $media_id ) {

	$delete = BP_Media::delete( array( 'id' => $media_id ) );

	if ( ! $delete ) {
		return false;
	}

	/**
	 * Fires at the end of the execution of delete media item
	 *
	 * @since BuddyBoss 1.0.0
	 *
	 * @param int $media_id ID of media
	 */
	do_action( 'bp_media_delete', $media_id );

	return $media_id;
}

Changelog

Changelog
Version Description
BuddyBoss 1.2.0 BuddyBoss 1.2.0
BuddyBoss 1.0.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.