Check If Post Content Has Shortcode

This PHP code enables you to execute a function if the post contains or doesn’t contain a short code.

has_shortcode( $content, '$tag' )

The code uses the has_shortcode function which includes 2 parameters.

$content – The content to search the single post for.
$tag – The short code to search for in each single post.

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.