WordPress.org

Ready to get started?Download WordPress

Forums

can't get esc_attr to work but esc_textarea does (1 post)

  1. richarduk
    Member
    Posted 2 years ago #

    Here's an example line of code for a textbox input:

    '<input class="custom-fields custom-fields-textbox" type="text" name="', $field['id'], '" id="a_', $field['id'], '" value="', esc_attr ($meta ? $meta : $field['default_textbox']), '" /><br />',

    That doesn't work, but replace esc_attr with esc_textarea and it does work. Meaning the relevant characters are encoded.

    Ditto with this:

    $allowed_html = array('strong' => array());
    		$meta = wp_kses($meta, $allowed_html);
    		$meta = esc_attr( $meta)

    Again, esc_attr doesn't work but esc_textarea does.

    I'm stuck.

Topic Closed

This topic has been closed to new replies.

About this Topic