Skip to main content

Filter: gk/block-mcp/media/uploads-enabled

Flip the AI's media library access to read-only in one line.

There's a setting for this, but the filter is the emergency brake: it wins over the stored option and needs no database write, so you can shut off every MCP upload instantly — from code, a must-use plugin, or an incident-response hook — the moment a token looks compromised or a policy says "no agent-uploaded files." Return false to refuse all uploads (multipart, URL sideload, and base64) with a clean 403.

Parameters

NameTypeDescription
$enabledboolWhether uploads are currently allowed by the stored option.

Example

// Make the media library read-only for the AI agent.

add_filter( 'gk/block-mcp/media/uploads-enabled', '__return_false' );

Since

Source

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