Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

“Read more” link after excerpts

Automatic excerpts end with a “Read more” link to the post instead of […].

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Category Posts and editor
  • Tested with WordPress 7.1
PHP
<?php

add_filter(
	'excerpt_more',
	static function () {
		$post = get_post();
		if ( ! $post ) {
			return '…';
		}
		return '… <a class="more-link" href="' . esc_url( get_permalink( $post ) ) . '">' . esc_html__( 'Read more' ) . '<span class="screen-reader-text"> ' . esc_html( get_the_title( $post ) ) . '</span></a>';
	},
	20
);

Good to know

Block themes show excerpts with the Post Excerpt block, which has its own “more” text setting.

In these packs

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.