Do you want to change the post excerpt length in WordPress? By default, WordPress displays the first 55 words of each post as the excerpt on your blog page, archive page, or search results page. However, you might want to customize the excerpt length to fit your design or content needs. In this article, we will show you how to change the post excerpt length in WordPress using two methods: using a plugin or using code.

Method 1: Using a Plugin

The easiest way to change the post excerpt length in WordPress is to use a plugin. There are many plugins that allow you to do this, but we recommend using Advanced Excerpt. This plugin not only lets you set the excerpt length in words or characters, but also gives you more options to control the excerpt output, such as:

  • Adding a read more link or button
  • Preserving HTML tags and formatting
  • Trimming the excerpt by sentence or paragraph
  • Excluding or including specific posts or categories
  • And more

To use this plugin, follow these steps:

  1. Install and activate the Advanced Excerpt plugin from your WordPress dashboard.
  2. Go to Settings > Excerpt and adjust the settings according to your preferences.
  3. Save your changes and check your site to see the new excerpt length.

Method 2: Using Code

If you prefer to use code instead of a plugin, you can also change the post excerpt length in WordPress by adding a custom function to your theme’s functions.php file. This method requires some basic coding skills, so make sure you backup your site before making any changes.

To use this method, follow these steps:

  1. Access your site’s files via FTP or your hosting control panel and locate your theme’s functions.php file. You can find it in wp-content/themes/your-theme-name/functions.php.
  2. Open the file in a code editor and add the following code at the end of the file:
<?php

// Change the post excerpt length in WordPress
function custom_excerpt_length( $length ) {
    // Set the excerpt length in words
    return 30; // Change this number to your desired length
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
  1. Save and upload the file back to your server and check your site to see the new excerpt length.

Conclusion

Changing the post excerpt length in WordPress can help you improve the readability and appearance of your site. You can do this easily using a plugin like Advanced Excerpt or using code in your functions.php file. We hope this article was helpful for you. If you have any questions or feedback, please let us know in the comments below. Thank you for reading!

Categorized in: