Skip to content

Instantly share code, notes, and snippets.

@kildeby
kildeby / Wordpress filter shortcodes
Last active August 29, 2015 14:08
Hide a specific shortcake or many from the_content() in Wordpress pages
<?php if(has_shortcode(get_the_content(), 'gmedia')) : ?>
<?php
$pattern = get_shortcode_regex();
preg_match("/$pattern/s", get_the_content(), $matches);
?>
<div id="content">
<?php echo strip_shortcodes(get_the_content()); ?>
</div>