简体   繁体   English

经过<p>以强大的形式标记到输入字段中 - wordpress</p>

[英]pass <p> tag into input field in formidable form - wordpress

I have a string that includes HTML tags that I would like to pass into an input field in a formidable form as a parameter.我有一个包含 HTML 标签的字符串,我想将其作为参数以强大的形式传递到输入字段中。 I structured the string as I would like it to be but I noticed that the input renders/displays the string but removes the HTML tags that I want to keep.我按照我希望的方式构建了字符串,但我注意到输入呈现/显示字符串但删除了我想保留的 HTML 标签。

$value = '<p>'.$name.'</p><p>'.$address.'</p><p>'.$bio.'</p>';
$value = htmlspecialchars($value);

when i echo $value it displays how i want it pass in as a parameter:当我 echo $value 它显示我希望它作为参数传入的方式:

<p>john doe</p><p>123 ave st.</p><p>history of john...</p>

This is how i am passing $value as a parameter in formidable这就是我将 $value 作为参数传递给 formidable 的方式

<div>[formidable id="4" value="<?php echo $value; ?>"]</div>

But the echoed text that is displayed is this:但是显示的回显文本是这样的:

john doe 123 ave st. history of john

without any of the <p> tags没有任何<p>标签

How i can i ensure that the HTML tags are not removed in the input field?我如何确保输入字段中的 HTML 标签未被删除?

use wp_kses使用wp_kses

$value = '<p>'.$name.'</p><p>'.$address.'</p><p>'.$bio.'</p>';
$value = wp_kses( $value, array( 'p' => array() ) );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM