WordPress.org

Ready to get started?Download WordPress

Forums

Problem with the_excerpt (2 posts)

  1. Nith
    Member
    Posted 5 years ago #

    Hello,

    In one of my posts, I have specified a url to an image for the excerpt.

    Now when I use the the_excerpt() function to fetch that url:

    <li><img src="<strong><?php the_excerpt();?></strong>" alt="" /></li>

    ...the following happens:

    <img src="<p>http://localhost/includes/assets/img/folio/eenappje.png</p>" alt="">

    As you can see, a "<p>" and "</p&gt" are added to the beginning and end of the url.

    How can I stop this?

    Thanks.

  2. nouveller
    Member
    Posted 5 years ago #

    You need to add this to functions.php or a plugin file.
    remove_filter('the_excerpt', 'wpautop');

    It removes the autowrapping of <p> tags.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.