in WordPress

WordPress Change Excerpt Length

In WordPress you can apply a excerpt to blog posts to give a preview of the post which is most likely used on category or search pages. The default for this is 250 characters but you can you can change this by adding a new filter.

Wordpress Hooks

WordPress allows you to add hooks into the code so you don't have to change the source code. Below is a snippet you can copy into your functions.php to change the excepts to 100 characters.


function change_excerpt_length( $length ) {
    return 30;
}
add_filter( 'excerpt_length', 'change_excerpt_length', 999 );

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email