- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
関数リファレンス/shortcode exists
提供: WordPress Codex 日本語版
特定のショートコード有無をチェックする関数です。
パラメーター
- $tag
- (string) (必須) チェックされるショートコード
- 初期値: なし
戻り値
- (bool)
- ショートコードが登録されていれば true。さもなくば false
使用法
<?php if ( shortcode_exists( 'gallery' ) ) { } ?>
使用例
<?php if ( shortcode_exists( 'gallery' ) ) { // [gallery] のショートコードが存在する } ?>
改訂履歴
- 3.6.0 にて導入されました。
ソースファイル
shortcode_exists() は wp-includes/shortcodes.php
にあります。
関連項目
ショートコード: do_shortcode(), add_shortcode(), remove_shortcode(), remove_all_shortcodes(), shortcode_atts(), strip_shortcodes(), shortcode_exists(), has_shortcode(), get_shortcode_regex(), wp_audio_shortcode(), wp_video_shortcode(), フィルター no_texturize_shortcodes /en
関数リファレンス、テンプレートタグ目次もご覧ください。
最新英語版: WordPress Codex » Function Reference/shortcode exists copy (最新版との差分)