Remove shortcode from home but not single posts

Adding this snippet to the functions.php of your wordpress theme will strip shortcode from your home page / index but not from single or archives posts.

 

 

function remove_shortcode_from_index($content) {
if ( is_home() ) {
$content = strip_shortcodes( $content );
}
return $content;
}
add_filter('the_content', 'remove_shortcode_from_index');

Be Sociable, Share!

Leave a comment