_e

Home » Functions » _e

The WordPress function _e() is used for translating and displaying translated strings. It’s a shorthand for the more verbose gettext function, which is used for internationalization and localization of WordPress themes and plugins.

The function takes a single argument, which is the text that needs to be translated. The function then looks for the translation of the text in the current language, and returns the translated text if it’s available.

This function also has a variant called __() that doesn’t echo the output but just returns the translated string.

An example usage of the _e() function is:

<?php _e( 'Hello World!', 'text-domain' ); ?>

In this example, the text ‘Hello World!’ will be translated into the current language based on the translation files available in the ‘text-domain’ and displayed on the page. If the current language isn’t available, the text will be displayed as is.

The _e() function is a powerful tool for making your WordPress themes and plugins more accessible to users in different languages, and it’s a key function for any developer working on WordPress websites.

Learn More on WordPress.org

Register an account to save your snippets or go Pro to get more features.