Translate a Constant while appeasing WordPress PHPCS
The following works but isn't up to snuff with PHP Code Sniffer WordPress coding standards
?php esc_html_e( ADDRESS, 'wprig' ); ?
Linter yells at me with:
[WordPress.WP.I18n.NonSingularStringLiteralText] The $text arg must be a single string literal, not "ADDRESS".
The following, for aforementioned error, also don't work:
?php esc_html_e( (string)ADDRESS, 'wprig' ); ?
?php esc_html_e( strval(ADDRESS), 'wprig' ); ?
?php esc_attr_e( ADDRESS, 'wprig' ); ?
I know constants can be exploited so it is needed. Any way to make this work besides //phpcs:ignore
, or is this not good practice and I should redo my use of constants?
Topic coding-standards escaping Wordpress
Category Web