Skip to content

Instantly share code, notes, and snippets.

@kailoon
Last active July 1, 2023 08:54
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save kailoon/01fa8e95d2e910e666c6 to your computer and use it in GitHub Desktop.
Save kailoon/01fa8e95d2e910e666c6 to your computer and use it in GitHub Desktop.
<?php
/**
* Escape all translations with
*/
__( ‘Some String’, ‘text-domain’ ); _e( ‘Some string’, ‘text-domain’ );.
/**
* When there is no HTML use:
*/
esc_html__( ‘Some String’, ‘text-domain’ ); esc_html_e( ‘Some String’, ‘text-domain’ );
/**
* For some HTML:
*/
wp_kses( __( ‘Some String something’, ‘text-domain’ ), $allowed_html_array );
@ngothoai
Copy link

ngothoai commented Jul 1, 2023

  1. All theme text strings are to be translatable and properly escaped. https://gist.github.com/kailoon/01fa8e95d2e910e666c6 example(s) from your code and there are more: https://envato.d.pr/fWcY4T
    @kailoon could you explain for me clear more about this point. What's it wrong?
    Envato required using function esc_html__() inserted __()?

Exactly, We can not use (), Only verify esc_html()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment