What does the WordPress “_e()” function do?

后端 未结 7 1208
遥遥无期
遥遥无期 2020-12-05 13:02

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 opt

相关标签:
7条回答
  • 2020-12-05 13:29

    It is a WordPress Function used for localization. See the WordPress Docs for localization.

    With this function you can output/assign "hardcoded" strings within your theme/plugin/code that are translateable (with .mo / .po files or plugins like WPML String Translation).

    The function __( 'My Text', 'my-text-domain' ); assigns a string "My Text" that is translateable. 'my-text-domain' is the text-doamin the string is referenced to. This function does not echo anything!

    The function _e( 'My Text', 'my-text-domain' ); is almost the same but it echoes your string directly.

    WordPress Offers several other functions for localization, take a look into the Codex (link on top of my answer).

    0 讨论(0)
提交回复
热议问题