続きを読むリンクに入っているアンカーを削除

投稿の下に付く「続きを読む」リンクからアンカーを削除しました。

おそらく、WordPressのテーマによって挙動が変わると思うだけど、
今使っているテーマでは、アンカーが入っていると挙動がおかしいので修正しました。

wp-includes/post-template.php の
the_content 関数内でアンカー(#more)を削除しています。


function the_content( $more_link_text = null, $strip_teaser = false) {
 $content = get_the_content( $more_link_text, $strip_teaser );

 // 続きを読むリンクのアンカーを削除
 $content = preg_replace( '|#more-[0-9]+|', '', $content );

 /**
 * Filter the post content.
 *
 * @since 0.71
 *
 * @param string $content Content of the current post.
 */
 $content = apply_filters( 'the_content', $content );
 $content = str_replace( ']]>', ']]>', $content );
 echo $content;
}