9.6. Inhalte auf Shortcode prüfen

Oft kommt es vor, dass Sie prüfen möchten, ob ein Shortcode in einem bestimmten Inhalt vorkommt. Dann nutzen Sie folgende Funktion:

<?php
function has_shortcode( $content, $tag ) {
	...
}
?>

Es gilt:

  • $content (string)
    Der Inhalt, der überprüft werden soll.
  • $tag (string)
    Der Name des Shortcodes.

Zurückgegeben wird entweder true, wenn der Shortcode existiert oder false, falls er nicht existiert.

Beispiel

You’re not allowed to see this content. Please log in first.