The WordPress.WP.I18n.MissingArgDomain sniff currently flags when a translation function is missing the text domain argument. However, its current severity level means it might not receive appropriate attention from plugin developers.
Background
- When the domain argument is missing in WordPress translation functions, the function will default to using core translations
- This behavior works technically but is discouraged in plugin or theme
- In 99.9% of cases, this occurs because plugin authors are unaware they need to specify their text domain, not because they intentionally want to use core translations
Proposal
Increase the severity level of this sniff from its current level to 7 (as a blocker in PCP).
Suggested improvement provided from Plugins Team meeting
Compare plugin strings with a map of WordPress core strings to reduce false positives when checking for missing text domains.
For example:
echo esc_html__( 'Submit' ): // WARNING: This string exists in WP core.
echo esc_html__( 'Example plugin specific string' ): // ERROR: This string is not in core.
The
WordPress.WP.I18n.MissingArgDomainsniff currently flags when a translation function is missing the text domain argument. However, its current severity level means it might not receive appropriate attention from plugin developers.Background
Proposal
Increase the severity level of this sniff from its current level to 7 (as a blocker in PCP).
Suggested improvement provided from Plugins Team meeting
Compare plugin strings with a map of WordPress core strings to reduce false positives when checking for missing text domains.
For example: