WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anyone advise on how I can remove the preceding <br> tag when a post's "read more..." tag is generated?

Any advice appreciated!

This is the code that's generated -

<p>blah blah blah blah<br>
 <a class="more-link" href="blahblahblahblah"> …Read more</a></p>

It's that annoying little
I want rid of, so the "read more" is on the same line...!

share|improve this question
Check out this answer of mine on "more span making trouble" question, I am not sure if you are referring to same issue as that question. – Rarst Dec 20 '10 at 11:29
Thanks for your reply, but the code being generated for me isn't in a span, it just has <br> then an anchor tag for the read more. Should there be a span around it? – Cordial Dec 20 '10 at 11:36
@Cordial: Please add the fragment of your theme that inserts the more link to your question. Please name the theme you are using. – hakre Dec 20 '10 at 14:52
@Cordial does adding blank lines around more tag, as described in that answer, in editor help? – Rarst Dec 21 '10 at 7:43

Can you show us your generated source code with more tag and code which you use for this?


Try this:

function clear_br($excerpt){
return str_replace("<br>","", $excerpt);
add_filter('the_excerpt', 'clear_br');

Paste this code in your functions.php

share|improve this answer

You'll wanna make a filter in your functions.php file. Scroll about halfway down on this codex page and they'll show two separate methods.

the_excerpt on WordPress Codex

Also, make sure your existing functions file doesn't already have something like this, which could be adding the line break in the first place.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.