wp change num words exerpct

To change the number of words in a WordPress excerpt, you can follow these steps:

  1. Open your WordPress admin dashboard and navigate to "Appearance" and then "Editor."
  2. In the right-hand column, locate and click on "functions.php" file.
  3. Add the following code at the end of the file:
function custom_excerpt_length($length) {
    return 20; // Change this number to your desired word count
}
add_filter('excerpt_length', 'custom_excerpt_length');
  1. Click the "Update File" button to save the changes.

This code uses the add_filter function to modify the length of the excerpt. You can replace the "20" in the return statement with your desired word count for the excerpt length. After adding the code, the WordPress excerpt will be limited to the specified number of words.