• Hey everyone.

    So I already have this funtion that takes out object tags from my excerpt, so that on the post page, the video is at the top of the page, but not in the excerpt.

    Here is that function:

    function strip_content_tags($content) {
        $content = strip_shortcodes($content);
        $content = str_replace(']]>', ']]>', $content);
        $content = preg_replace('/<img[^>]+./','',$content);
        $content = preg_replace('%<object.+?</object>%is', '', $content);
        $content = preg_replace('%<a.+?</a>%is', '', $content);
        return $content;
    }

    I want to do the same, but exclude links. I added the last line to do that, but it takes out EVERYTHING. I want the text to stay there.

    My website is freshstreetmag.com

    You can see on the latest post that the last word in the excerpt is clearly missing.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Exclude links from excerpts’ is closed to new replies.