Skip to content

Instantly share code, notes, and snippets.

@petenelson
Created September 11, 2024 14:14
Show Gist options
  • Save petenelson/e5d2953eeab9ff0342b4a16419e30d01 to your computer and use it in GitHub Desktop.
Save petenelson/e5d2953eeab9ff0342b4a16419e30d01 to your computer and use it in GitHub Desktop.
WordPress: Find All Shortcodes
<?php
$regex = get_shortcode_regex();
// Find all registered tag names in $content.
preg_match_all( "/$regex/", $content, $matches );
if ( ! empty( $matches ) ) {
var_dump( $matches[2] );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment