1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Links in Wordpress Excerpts?

Discussion in 'General Programming Chat' started by samiejg, Dec 29, 2013.

  1. samiejg

    samiejg Senior Member

    Dec 14, 2013
    Likes Received:
    I noticed that with Wordpress that they actually don't allow links in their excerpts. I didn't understand why until I actually proceeded to re-write some of the functions. However, now I know why they are not used. It seems that if your excerpt gets cutoff while in an anchor tag that it actually breaks the link and the rest of your page ends up being a link because the anchor tag didn't get closed properly.

    Has anyone else experienced this and/or know how I could get this fixed?
  2. anaman123456

    anaman123456 Newbie

    Dec 31, 2013
    Likes Received:
    use below, i hope its helpful..;)
    // Changing excerpt more
    function new_excerpt_more($more) {
    global $post;
    return '... <a href="'. get_permalink($post->ID) . '">' . 'Read More »' . '</a>';
    add_filter('excerpt_more', 'new_excerpt_more');