bp_rest_restrict_wp_attachment_response( WP_REST_Response $response, WP_Post $post )
Empty response in single WordPress Media endpoint when fetch media/document.
Description
- Privacy security.
Parameters
- $response
-
(Required) The response object.
- $post
-
(Required) The original attachment post.
Return
(array)
Source
File: bp-core/bp-core-filters.php
function bp_rest_restrict_wp_attachment_response( $response, $post ) {
$media_meta = get_post_meta( $post->ID, 'bp_media_upload', true );
$document_meta = get_post_meta( $post->ID, 'bp_document_upload', true );
$data = $response->get_data();
if (
array_key_exists( 'media_type', $data ) &&
(
! empty( $media_meta ) ||
! empty( $document_meta )
) &&
(
! is_user_logged_in()
|| ! current_user_can( 'edit_post', $post->ID )
)
) {
$response = array();
}
return $response;
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.5.5 | 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.