Shortcodes appearing in archive and index pages (2 posts)

  1. kangel
    Posted 6 years ago #

    I am having a huge issue with shortcodes—they are appearing in all of my index and archive pages. When I add the

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

    code to my functions.php, it only removes the shortcode (i.e. image and caption) on my actual post page. I just need this code to be removed from archive and search result pages.

    Currently I have the site 'under construction' because of this error. If you need to see the page, contact me please and I can give you access.

    Any help is appreciated.

  2. esmi
    Forum Moderator
    Posted 6 years ago #

    Try changing:

    if ( is_home() )


    if ( is_archive() )

Topic Closed

This topic has been closed to new replies.

About this Topic