Skip to content

Instantly share code, notes, and snippets.

@ScottDeLuzio
Created March 15, 2016 20:58
Show Gist options
  • Save ScottDeLuzio/8c843484dd3ab8865718 to your computer and use it in GitHub Desktop.
Save ScottDeLuzio/8c843484dd3ab8865718 to your computer and use it in GitHub Desktop.
Strip shortcodes from the content home/blog page
<?php
/*
Plugin Name: Strip Shortcodes
Description: Strip shortcodes from home/blog posts page
*/
function strip_shortcode_from_excerpt( $content ) {
if ( is_home() ) {
$content = strip_shortcodes( $content );
}
return $content;
}
add_filter( 'the_content', 'strip_shortcode_from_excerpt' );
@ScottDeLuzio
Copy link
Author

This is an adaptation of the code found on https://codex.wordpress.org/Function_Reference/strip_shortcodes

Added here to easily download and install a plugin version of the same code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment