---
id: gk-block-mcp-media-upload-overrides
title: "Filter - gk/block-mcp/media/upload-overrides"
sidebar_label: "gk/block-mcp/media/upload-overrides"
tags:
  - "2.0.0"
---

# Filter: gk/block-mcp/media/upload-overrides

Fine-tune how WordPress handles an agent's multipart file upload.

Every file the agent uploads through `POST /media` is finally handed to core's `wp_handle_upload()`, and this array is the control panel for that step. Hook in when you need to bend the rules for a specific deployment — relax a check, accept an extra MIME type, or route the file through a different upload action. The value is forwarded verbatim as the overrides argument to `media_handle_upload()`. Most sites should leave the default `array( 'test_form' =&gt; false )` alone; if a filter returns anything that isn't an array, the plugin safely falls back to that default.

## Parameters

| Name | Type | Description |
|------|------|-------------|
| $default_overrides | `array` | Overrides passed to media_handle_upload(). Default array( 'test_form' =&gt; false ). |
| $field | `string` | The $_FILES key whose upload is being processed. |

## Example

// Permit an extra file type for agent uploads.

```php
add_filter( 'gk/block-mcp/media/upload-overrides', function ( $overrides, $field ) {
    $overrides['mimes'] = array( 'webp' => 'image/webp' );
    return $overrides;
}, 10, 2 );
```

### Since

- [2.0.0](../../since/2-0-0/)

### Source

Defined in `wordpress-plugin/gk-block-api/includes/class-media-manager.php` at line 251

