• 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>https://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.

Viewing 1 replies (of 1 total)
  • You need to add this to functions.php or a plugin file.
    remove_filter('the_excerpt', 'wpautop');

    It removes the autowrapping of <p> tags.

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with the_excerpt’ is closed to new replies.