Automattic\WooCommerce\Internal\ProductDownloads

DownloadableFileAttachments::handle_rest_attachment_query │ public │ WC 1.0

Mark REST API media collection queries to exclude downloadable product files.

Method of the class: DownloadableFileAttachments{}

No Hooks.

Returns

array|mixed.

Usage

$DownloadableFileAttachments = new DownloadableFileAttachments();
$DownloadableFileAttachments->handle_rest_attachment_query( $args );
$args(array|mixed) (required)
WP_Query arguments.

DownloadableFileAttachments::handle_rest_attachment_query() code WC 11.3.0

public function handle_rest_attachment_query( $args ) {
	if ( is_array( $args ) && ! $this->current_user_can_see_files() ) {
		$args[ self::EXCLUDE_QUERY_VAR ] = true;
	}

	return $args;
}