Created
September 11, 2024 14:14
-
-
Save petenelson/e5d2953eeab9ff0342b4a16419e30d01 to your computer and use it in GitHub Desktop.
WordPress: Find All Shortcodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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