bp_rest_restrict_oembed_request_post_id( int $post_id )

Restrict users to access media and documents from /wp-json/oembed/1.0/embed

Description

Parameters

$post_id

(Required) Current post id.

Return

(mixed)

Source

File: bp-core/bp-core-filters.php

function bp_rest_restrict_oembed_request_post_id( $post_id ) {
	$media_meta    = get_post_meta( $post_id, 'bp_media_upload', true );
	$document_meta = get_post_meta( $post_id, 'bp_document_upload', true );
	if (
		(
			! empty( $media_meta ) ||
			! empty( $document_meta )
		) &&
		(
			! is_user_logged_in()
			|| ! current_user_can( 'edit_post', $post_id )
		)
	) {
		$post_id = 0;
	}

	return $post_id;
}

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.