Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the WordPress "_e()" function do?

Tags:

php

wordpress

I have these all over my theme, and when if I delete them, there nothing happens to the theme. What does it do? Should I leave them in or are they unnecessary? I want to optimize my site to load faster, so this is why I'm asking.

like image 876
Adam Avatar asked Apr 25 '11 04:04

Adam


People also ask

What is _E in WordPress?

_e() = echo the translated string.

How do I translate a string in WordPress?

To get started, install the free TranslatePress plugin from WordPress.org. Then, go to Settings → TranslatePress to choose the language(s) into which you want to translate your site. Again, the free version lets you translate your site into one new language, while the premium version lets you use unlimited languages.

What is esc_html in WordPress?

esc_html. Filters a string cleaned and escaped for output in HTML.

What is Esc_attr in WordPress?

Filters a string cleaned and escaped for output in an HTML attribute. wp-includes/formatting.php: wp_check_invalid_utf8()


2 Answers

https://developer.wordpress.org/reference/functions/_e/

In WordPress, strings in the php files are marked for translation to other languages, and localization using two “tags” which are actually functions. They are:

__() _e()

like image 171
austinbv Avatar answered Sep 26 '22 03:09

austinbv


They are used for localization in WordPress themes. If you're only using one language for your theme, you don't need them.

like image 40
Gustav Larsson Avatar answered Sep 25 '22 03:09

Gustav Larsson