php - How to escape echo for input tag?

How should I escape echo for this function...function pen_post_sidebar_twitter() {$twitter = esc_attr( get_option( '

How should I escape echo for this function...

function pen_post_sidebar_twitter() {
    $twitter = esc_attr( get_option( 'twitter_handler' ));
    echo ( '<input type="text" name="twitter_handler" value="'.$twitter.'" placeholder="Twitter handler" /> <p class="description">Enter twitter handler without the @ sign.</p>' );
}

How should I escape echo for this function...

function pen_post_sidebar_twitter() {
    $twitter = esc_attr( get_option( 'twitter_handler' ));
    echo ( '<input type="text" name="twitter_handler" value="'.$twitter.'" placeholder="Twitter handler" /> <p class="description">Enter twitter handler without the @ sign.</p>' );
}
Share Improve this question asked Jan 8, 2020 at 13:22 webfuelcodewebfuelcode 212 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Try this

function pen_post_sidebar_twitter() {
    printf( '<input type="text" name="twitter_handler" value="%s" placeholder="Twitter handler" /> <p class="description">Enter twitter handler without the @ sign.</p>', esc_attr( get_option( 'twitter_handler' ) ) );
}

Thanks

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744849802a4597060.html

相关推荐

  • php - How to escape echo for input tag?

    How should I escape echo for this function...function pen_post_sidebar_twitter() {$twitter = esc_attr( get_option( '

    2天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信