Created
January 24, 2017 23:20
-
-
Save danemorgan/888adeb21f8831df390284bb98216495 to your computer and use it in GitHub Desktop.
Find shortcodes in WordPress Posts
This file contains hidden or 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 | |
// Regular Expression to match [shortcodes]. | |
$regex = '(\[title(.*?)?\](.+?)?\[\/title\])'; | |
// Store them in an array | |
preg_match( $regex, $content, $action_matches ); | |
// Remove them. | |
preg_replace( $regex, '', $content ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment