How to Customize WordPress Excerpt?Length
MD Zakaria Islam
Senior WordPress Developer, Expert in developing WordPress Theme, Plugin, Gutenberg Block. A big fan of Headless WordPress. Talks about PHP | Javascript | React | Vue | Laravel | Shopify App Development
WordPress Excerpt displays a portion of the whole content. Usually, in the case of archive page, this excerpt is used to display a part instead of showing whole content.
Need help in fixing WordPress issues or Customization, Contact Me
It is often needed to change the excerpt default length based on your needs. So, if you are feeling the need of setting a custom excerpt length for your website, this post will satisfy your query.
We will use a filter hook named excerpt_length. It accepts a parameter that contains the length of the post. So, simply write the following codes in the theme’s functions.php file.
Set your expected value to return like 30. As a result, now 30 words will be displayed.