我写了一个简短的代码,如下basic 有关Wordpress Codex的说明:
function myshortcode( $atts, $content = null ) {
    extract( shortcode_atts( array(
        ...,
    ), $atts ) );
    return some_html _code_here . $content;
}
 当我把
[myshortcode]
this 
is 
a 
test
content
[/myshortcode]
 在一篇帖子中,我获得了以下输出:
this <br />
is <br />
a <br />
test <br />
content <br />
 如何避免插入br/标签?
 
                    最合适的回答,由SO网友:Charles Clarkson 整理而成
                    这个<br /> 标签正在由添加到内容中wpautop() 作用如果在运行shortcode之前运行它,它们将不在那里。它已添加到\\wp-includes\\default-filters.php 默认优先级为10.
add_filter( \'the_content\', \'myshortcode\', 1 );
function myshortcode( $atts, $content = null ) {
    return $content;
}
wpautop() 除此之外,还可以添加其他标记
<br /> 标签。