WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

Back in my naive days of theming, I had to make it so the link inserted by <!--more--> wouldn't dump the viewer at the anchor it produces.

I made a dinky plugin that consisted of:

function No_More_Link($buffer) {
  $inHTML[0] = '/#more-\d+/';
  $outHTML[0] = '';
  return preg_replace($inHTML, $outHTML, $buffer);

Years later, I thought I could do much better, by using a filter in the theme's functions.php file:

function no_more_link ( $input ) {
  return preg_replace( '/#more-\d+/', '', $input );
add_filter( 'get_permalink', 'no_more_link' );

This doesn't work. I've tried bumping up the priority to ridiculous levels.

Am I applying the filter to the wrong thing? What am I missing here?

share|improve this question
up vote 0 down vote accepted

You can filter the_content_more_link hook and remove #more-POST_ID from the link:

function wpse_51806_strip_more_link( $more_link ) {
    global $id;
    return str_replace( "#more-$id", '', $more_link );
add_filter( 'the_content_more_link', 'wpse_51806_strip_more_link' );

It has even been made into a plugin, if you're more comfortable with plugins then code snippets.

share|improve this answer

you are kind-of asking to re-invent the wheel - http://codex.wordpress.org/Customizing_the_Read_More#Link_Jumps_to_More_or_Top_of_Page

some background: the 'more-link' gets added in /wp-includes/post-template.php line 217 (in wp3.2) as part of the get_the_content() function;

  $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.