WP SITES

3086 Coded Tutorials & 291 Plugins

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.

Leave a Reply

New Plugins