0

it's been a week I'm trying to fix errors generated by Theme Sniffer Plugins. but I have not succeeded, please help here are the code and the errors:

<p class="site-description"><?php esc_html_e( $dro_web_trader_description,'dro-web-trader' );  ?></p>
96  ERROR   The $text arg must be a single string literal, not "$dro_web_trader_description".

$tags_list = get_the_tag_list('', esc_html_x('', 'list item separator', 'dro-web-trader'));
37  ERROR   Strings should have translatable content

 printf('<span class="tags-links row">' . esc_html__('%1$s', 'dro-web-trader') . '</span>', $tags_list); // WPCS: XSS OK.
40  ERROR   Strings should have translatable content

1 Answers1

1

I'm not a WordPress developer, but I've looked at the PHPCS sniffs for the WordPress standard and I think I might know why these are being generated.

<p class="site-description"><?php esc_html_e( $dro_web_trader_description,'dro-web-trader' );  ?></p>
96  ERROR   The $text arg must be a single string literal, not "$dro_web_trader_description".

You can't pass variables to these translation functions due to various translations tools not being able to detect these strings properly. There is more info here: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/50

$tags_list = get_the_tag_list('', esc_html_x('', 'list item separator', 'dro-web-trader'));
37  ERROR   Strings should have translatable content

You're passing an empty string to translate, so there is nothing for the translation function to do.

 printf('<span class="tags-links row">' . esc_html__('%1$s', 'dro-web-trader') . '</span>', $tags_list); // WPCS: XSS OK.
40  ERROR   Strings should have translatable content

You're passing a string that only contains replacement variables, so there is no need to use translation here.

Greg Sherwood
  • 6,992
  • 2
  • 29
  • 24