Developers

apply_filters( 'riff_can_play', bool $allowed, array $track, int $attachment_id, int $post_id )

Filters whether the current visitor may play a track.

Parameters

$allowedbool
Whether the track plays. Default true.
$trackarray
Track, after riff_track.
$attachment_idint
Attachment ID, or 0 for a file outside the Media Library.
$post_idint
The post the track appears in, or 0.

More Information

A membership or store plugin returns false for a track its rules keep from this visitor. The track is then listed as locked rather than hidden, with no file to play.

Usage

add_filter( 'riff_can_play', function ( $allowed, $track, $attachment_id, $post_id ) {
	return $allowed;
}, 10, 4 );

Source

if ( (bool) apply_filters( 'riff_can_play', true, $track, $attachment_id, $post_id ) ) {

Changelog

VersionDescription
4.17.0Introduced.