Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Edit WordPress excerpts
// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
global $post;
return '... <a class="read-more-link" href="'. get_permalink($post->ID) . '">Read More</a>';
add_filter('excerpt_more', 'new_excerpt_more');
// change excerpt length
function custom_excerpt_length( $length ) {
return 39;
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.