Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.