1. 首页
  2. 技术知识

【WordPress相关】WordPress 常用函数 / has_shortcode

作品分类:Wordpress相关  指定  内容  源文件  函数  常用  WordPress  has_shortcode

WordPress 常用函数 / has_shortcode,

简介

检查内容中是否含有指定的 Shortcode。

用法

<?php if ( has_shortcode( $content, 'gallery' ) ) { } ?>

参数

$content
(string) (required) 要检测的内容
Default: None

<script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>

$tag
(string) (required) 指定的 Shortcode
Default: None

返回值

(Bool)
指定的 Shortcode 找的返回 true,否则 false。

修改记录

Since 3.6.0

源文件

wp-includes/shortcodes.php.

原创文章,作者:starterknow,如若转载,请注明出处:https://www.starterknow.com/32074.html

联系我们