As stated in the docs, if the quicktag <!--more-->
is used in a post to designate the “cut-off” point for the post to be excerpted, the_content()
tag will only show the excerpt up to the <!--more-->
quicktag point on non-single/non-permalink post pages.
WordPress adds <span id="more-' . $post->ID . '"></span>
to the content in this case. Since there’s no content in the <span>
(check out the code), you can easily remove the <span>
by filtering the content:
add_filter( 'the_content', function( $content ) {
return str_replace( '<span id="more-' . get_the_ID() . '"></span>', '', $content );
}
Note that this causes the Read More link not to jump to the area where you inserted <!--more-->
anymore. An easier way to achieve this would be to use the the_content_more_link
filter and remove the #more-<post_id>
part from it there. There are a few examples in the Codex for that.