HTML code in Custom field

UPDATED ANSWER

The correct function to use in context to WordPress and its intended API for this purpose is;

esc_textarea

Thus your code would reflect something like this;

<textarea><?php echo esc_textarea($images);?></textarea>

Although htmlspecialchars and htmlentities are valid to use, and even though esc_textarea wraps htmlspecialchars anyway, its more appropriate to use the official API call.

I’ve left my original answer below for reference purposes, however swap out the relevant functions as needed.

ORIGINAL ANSWER

In your snipped at Pastebin replace your images_box function with (start of line 65);

function images_box($echo = FALSE){
  global $post;
  $custom = get_post_custom($post->ID);
  $images = $custom["images"][0];
  ?>
  <textarea name="images" cols="100" rows="10">

      <?php echo htmlspecialchars($images); //Hi, I'm your input! ?> 

  </textarea>
  <?php
}

You were not echoing the value of your input between the <textarea> ECHO INPUT HERE </textarea> tags thus it appears you were not entering anything at all.

Also wrap your input with htmlspecialchars

Also $city = $custom["images"][0]; should be $images = $custom["images"][0]; (line 68)

Leave a Comment