Skip to content

Quick Tip: replacing URLs in post excerpts

I generally find WordPress excerpts a little bit irritating. They ignore all formatting, including paragraphs, so you just end up with a block of text with no styling and sometimes little sense.

To make matters worse, if your content includes a URL you’ll end up with the whole thing displayed in the excerpt, no matter how long or nonsensical it looks. Luckily, this is easily remedied with a little code.

Drop the code below into your functions.php file and those URLs will be stripped out of the excerpt:

stuff we dig

FYI: yes, the above are affiliate links, so we do make a small amount of money if you follow them over and buy what they're selling. Thank you for helping pay our hosting costs!

Dave Kuhar

Dave is the jack-of-all-trades running Transmit Studio, a media creation lab in San Jose. He's built more websites than he can remember, well over a hundred of them on WordPress. Whether it's tradeshow booths, video/TV, graphic design, presentations, magazine, tearsheet, and catalog layout, corporate identity packages, or just about any other kind of visual communication project, he's worked on it!

Leave a Comment





Scroll To Top