• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

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.

Register for full access

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags