WpCode.net

Daily Wordpress Code Snippet

How to remove shortcode from home but not from the entire blog

| 0 comments

Pin It

If you want to remove a shortcode from your blog’s home page, but not from posts, you may use this snippet. Just paste the code to your function.php to remove the shortcode value from index.php or home.php but not from the rest of your template Continue reading

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

Si noti che il tag condizione (is_home) disabilita tutti gli shortcode, ma solo dalla home page del tuo blog wordpress.

Leave a Reply

Required fields are marked *.

*