WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to translate "Upload an image" by using _(), _e(). It does not work for me. I tried value= _e( 'Upload an image') but did not work out.

function logo_image() {
 $options = get_option('plugin_options');
      echo"<input type='text'  class='regular-text text-upload' name='plugin_options[logo_image]' value='{$options['logo_image']}'/>";
      echo "<input type='button' class='button button-upload' value='Upload an image'/>";
      echo"<img style='max-width: 200px; display: block;' src='{$options['logo_image']}' class='preview-upload'/>";
share|improve this question

Use esc_attr__() to translate and escape strings for HTML attributes:

$button_text = esc_attr__( 'Upload an image', 'your_text_domain' );

echo "<input type='button' class='button button-upload' value='$button_text' />";
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.