• alainroger

    (@alainroger-1)


    Hello,

    i’m trying to create a new plugin. I checked some plugins in order to understand how it works and i wanted to sanitize and prepare for multilanguage my plugin.
    In this purpose i saw that i have to use the following function:
    esc_html_e();

    however this function is only define in wp-includ/l10n.php file.

    therefore i would like to know if there is an easy way to include this file in my plugin code or if i have to use the standard require_once() function ?
    i
    because i thought as we are in the admin side, the function esc_html_e() is automatically accessible….

    so maybe i do something wrong.

    thx

Viewing 1 replies (of 1 total)
  • Joy

    (@joyously)

    If your code is a WordPress plugin, then you can use most WordPress functions without needing to require the files. There are exceptions, like some of the admin things that are not used everywhere and are only loaded where needed.

    If you get errors for that function, your code is not structured correctly. You have to put most code into functions and have the functions called by actions or filters. See https://codex.www.ads-software.com/Plugin_API/Action_Reference

Viewing 1 replies (of 1 total)
  • The topic ‘esc_html_e() function in custom plugin’ is closed to new replies.