There are several things wrong with your code
-
The is no need for translation there. The message should have been translated before it is being passed to that function. At that function there is actually no context at all to create any different translation than
%s -
Escaping should happen at the output. You should escape the result of the
sprintfand the translation.
And keep in mind that WPCS is a tool to help you, not the bible. At least at its current stage it lacks too many feature to just blindly follow it all the time. Some of the errors it emits right now are due to bad parsing of modern PHP or lacking features, so if you are 100% sure that in your specific case %s should be translatable go with it.
Related Posts:
- Running WP Cron on multisite the right way
- Why isn’t WordPress part of Framework Interop Group?
- WP-CLI – Selecting PHP version
- When to use Exceptions vs Error Objects vs just plain false/null
- WordPress and event-driven programming – what is it about?
- WP CLI info showing correct PHP binary but wrong version of PHP
- Utilize WP-CLI from inside WordPress, not SSH
- Setting Up PHPUnit tests for WP development on Windows
- How to set up phpcs with WordPress coding standard with PHP8?
- Configuring WP-CLI on Windows 10
- Different output from WP-CLI in bash vs PHP exec()
- Is it better to create a function or a variable for current_theme_supports?
- wp search-replace on database returns PHP fatal error: Array and string offset access syntax with curly braces is no longer supported
- PHP Parse error on WP-CLI, not on web server
- WP-CLi PHP Warning: mysqli_query(): (HY000/1356): View During Search Replace
- call to undefined function mysql_connect
- Should I use wp_cache in my plugin to make it faster?
- How come there is no error if I upgrade WordPress core after locking .htaccess permissions to 644?
- Full search and replace isn’t enough to make all pictures to be loaded with https
- How can one use variables in a template or template part without polluting the global scope?
- Cannot register a custom WP-CLI command
- Run a WP-CLI command from within PHP without using shell_exec()
- Running WP-Cron on Multisite networks the right way?
- Custom query to get post names beginning with a digit
- Custom Yoast Breadcrumbs URL
- How to check from which page the user is coming to the current page?
- Insert code when users come from an specific referer
- CSS saved & enqueued, but wordpress doesn’t load css text, only file
- Execute only on a certain page
- Add a Custom Class to Admin Menus
- Type hinting and void return question
- login wp impossible
- Replace comment avatars and links at the same time
- Can WordPress email the admin about PHP errors, while hiding them from the site?
- wordpress upgrade has broken my permalinks
- Using get_bloginfo(‘template_directory’) or variable – performance issue
- Word Count Function Preventing Permalink Editing
- How to call function that create table in database (plugin functionality)
- How to display to visitor which site they came from?
- Changing custom logo link
- How to query for posts with a null or blank post_name?
- WordPress pagination not working with search page
- Change the CSS of the Customizer API
- What is the correct way to write this conditional statement?
- Grab posts by multiple categories
- Auto-update products after they were published – Woocommerce
- Customizer: active_callback and sanitize_callback incompatibility?
- Set Order Status to Complete After Payment – from another site
- Display image from an external rss feed on wordpress without plugins
- How can I hide that I Use WordPress (with W3 Total Cache)
- Shortcode with PHP issue “Undefined index”
- Using same variable names in files added with get_template_part()
- Changing the_posts_navigation() html output
- Custom PHP script throws critical error ONLY when editing page
- Override a function defined in wp-includes/comment-template.php
- User register hook is not working in woocomerce register form
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- How can i count the post added in relationship field, theme display
- How to get the last category name of a child category?
- How can I add a UTM tag with PHP code to pick up the post slug dynamically in the UTM?
- the_posts_pagination() not working in wpquery
- Using ob_start and ob_get_clean with wordpress shortcode
- Custom meta box values are not getting saved for my custom post type
- locale filter function running multiple times
- How to include custom PHP file both in header and footer files
- get post id from wp_insert_post for get_template_part
- Send notification email to admin for every new post published
- Retrieve Json data and create multiple pages with it
- How to extract information from a wp_query result?
- Cloning add_settings_field() with jQuery
- Meta boxes only displayed when editing normal (default wp post_type) posts
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Limit ‘contributers’ abilities in WordPress
- Problem with data collection in tables
- How to set value selected using select2 jquery plugin
- how to get sentence values from wordpress shortcode parameter?
- Disable send password change email to user wordpress
- How to update ticket price programatically when adding to cart and checkout in woocommerce
- How to use wp_get_attachment_image or wp_get_attachment_image_src instead of $instance[‘single_feature_image_uri’]
- Query by pagename not Working
- How can i avoid duplicate same post in wp?
- Fatal error: Uncaught Error: Class ‘WP_Block_Styles_Registry’
- AJAX and custom pages
- Custom meta box is not displaying value showing tag as empty
- Replace header with large image on home page only, using Genesis child theme
- How to make a vote in the poll for registered users?
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Add class for the_post_thumbnail_caption()
- AJAX Filter WHILE Loop not working WordPress
- Weird Behaviour: Not all WordPress Posts appearing
- PHP in WordPress?
- Child theme not working properly
- Where to place PHP for shortcodes
- Hide a div from a particular page and single pages in WordPress
- Facebook php sdk 4 getSessionFromRedirect() always null
- php snippets in html are being commented out
- use wpdb object on other file
- wp_register_script – illegal string offset
- Editing stylehseet url in head section of WordPress
- Single wordpress multi website down need help factoring what it is