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?