Is this a correct usage of esc_html_e?

You should always escape output. end of sentence, and end of story. The questions is like asking if you can use globals and goto. Sure they are part of the language and in some edge cases they are the only way to produce working and readable code, but the guide is to never use them … Read more

WooCommerce: Translation lost on AJAX call in Checkout page [closed]

I think I fixed the issue with the following extended function in my plugin: function localize_backend( $locale ) { // set langauge if user is in admin area if( defined( ‘WP_ADMIN’ ) || ( isset( $_REQUEST[‘pwd’] ) && isset( $_REQUEST[‘kau-boys_backend_localization_language’] ) ) ){ // ajax call from frontend if ( ‘admin-ajax.php’ == basename( $_SERVER[ ‘SCRIPT_FILENAME’ … Read more

Using polylang, how can I see which post is the “original” and which are the “translated children”? [closed]

polylang stores translation in a taxinomy but it’s better to access them with the polylang object like that : // test if the plugin polylang is present if (isset($GLOBALS[“polylang”])) { $translations = $GLOBALS[“polylang”]->model->post->get_translations($post->ID); // $translations contains an array with all translations of the post } all translations are interconnected then there is no parent translation. … Read more

Compile errors during translation compile

The % character is a special character in the gettext translation functions. To escape the % character to use it in a string, change it to %%. If you weren’t using the __() translation functions, then a single % character would give you the number of comments. However, when you are using the translation functions, … Read more