WP Kernel API / core/src / detectNamespace
Function: detectNamespace()
ts
function detectNamespace(options): NamespaceDetectionResult;
Detect namespace with intelligent auto-detection
Implements the detection priority cascade:
- Explicit namespace parameter
- Build-time defines (WPK_NAMESPACE, import.meta.env.WPK_NAMESPACE)
- Module ID extraction (Script Modules pattern)
- WordPress plugin header 'Text Domain'
- package.json 'name' field
- Fallback to default
Parameters
options
NamespaceDetectionOptions
= {}
Detection options
Returns
Detection result with namespace and metadata