strip_shortcodes()
strip_shortcodes( string $content ) 从给定内容中删除所有快捷方式标记。 R…
strip_shortcodes( string $content )
从给定内容中删除所有快捷方式标记。
Remove all shortcode tags from the given content.
从给定内容中删除所有快捷方式标记。
Remove all shortcode tags from the given content.
目录锚点:#参数#源码#笔记
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $content | (string) | 删除快捷代码标记的内容。 |
源码(Source)
/**
* Remove all shortcode tags from the given content.
*
* @since 2.5.0
*
* @global array $shortcode_tags
*
* @param string $content Content to remove shortcode tags.
* @return string Content without shortcode tags.
*/
function strip_shortcodes( $content ) {
global $shortcode_tags;
if ( false === strpos( $content, '[' ) ) {
return $content;
}
if (empty($shortcode_tags) || !is_array($shortcode_tags))
return $content;
$content = do_shortcodes_in_html_tags( $content, true );
$pattern = get_shortcode_regex();
$content = preg_replace_callback( "/$pattern/s", 'strip_shortcode_tag', $content );
// Always restore square braces so we don't break things like| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.5.0 | wp-includes/shortcodes.php | 7 | 16 |
笔记(Notes)
删除主页上的快捷方式,但不能在单个或存档页上显示
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!