Support » Fixing WordPress » Changing 120 word default of the_excerpt

  • Is there a way to change the 120 word default of the_excerpt? I’d like to change it so that it is always 40 or 50 words.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can edit the core files – never advisable…
    You can use a plugin, like

    Thread Starter fx3000


    moshu,do you know where this is in the core files? I’m new to WordPress.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Where did you get the idea that it defaulted to 120 words? Near as I can tell, it defaults to 55 words.

    functions-formatting.php – function name is wp_trim_excerpt

    From the plug-in above, I suppose. 😉

    Displays defaults: 120 word excerpt; allow anchor (<a>) tag; ‘excerpt’ as filter type, use “(more…)” as more link if excerpt less than content; fake content as excerpt unless post has an excerpt.</a>

    The Codex says so (120) – though I’ve never counted 🙂

    The code says 55 though – I also tried changing it to a lesser number, doesn’t seem to work in certain circumstances. Those include – putting a huge amount of text in, say the same as the article, and the_excerpt() prints the whole thing out. Weird.

    First, the Codex (and my plugin’s) documentation says 120 because that is what it originally was. But this was changed a while back from 120 to the current 55. There was a brief period where it was 70, but we don’t talk about that… ;)

    Second, word count is always going to be an iffy affair. It’s just the nature of this sort of thing.

    Finally, the_excerpt() *summarizes* only when it extracts an excerpt from a post’s content. If you place something in the post editor’s optional excerpt field, not only will this become your excerpt (naturally), but the_excerpt() assumes you want it all, and will not….excerpt the excerpt.

    EDIT: I’ve visited the obvious Codex docs where the excerpt word count is referenced and updated these. But please, if you see something on Codex that is incorrect and you know what it should be, feel free to change it. Just like the support forums, the Codex documents are a community effort.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Changing 120 word default of the_excerpt’ is closed to new replies.