Title: PHP Warning: Undefined array key &#8220;excerptLength&#8221;
Last modified: June 16, 2026

---

# PHP Warning: Undefined array key “excerptLength”

 *  [SRD75](https://wordpress.org/support/users/srd75/)
 * (@srd75)
 * [3 days, 23 hours ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-excerptlength-2/)
 * Hi,
 * Our site’s error_log has several instances of:
 *     ```wp-block-code
       PHP Warning: Undefined array key "excerptLength" in /home/user/staging.example.com/wp-includes/blocks/post-excerpt.php on line 52
       ```
   
 * Help appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Abu Hurarrah](https://wordpress.org/support/users/hurairah922/)
 * (@hurairah922)
 * [3 days, 21 hours ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-excerptlength-2/#post-18939390)
 * Hi,
 * This warning is usually caused by a Post Excerpt block being rendered without
   the expected `excerptLength` attribute being present.
 * Could you provide some additional details?
    - What version of WordPress are you running?
    - Does the warning occur on the front end, in the editor, or both?
    - Are you using a custom theme or any plugins that modify Query Loop or Post
      Excerpt blocks?
    - If you switch temporarily to a default theme such as Twenty Twenty-Five, does
      the warning persist?
 * Also, if possible, please share the full Site Health > Info > WordPress version
   information and the complete warning message from the log.
 * That will help determine whether this is coming from WordPress core, a theme,
   or a plugin altering block attributes.
 *  Thread Starter [SRD75](https://wordpress.org/support/users/srd75/)
 * (@srd75)
 * [20 hours, 39 minutes ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-excerptlength-2/#post-18942855)
 * Hi,
 * WP version 7.0.
   Error only occurs in error_log.
 * > Are you using a custom theme or any plugins that modify Query Loop or Post 
   Excerpt blocks?
 * I don’t think so
 * I have switched to 2025, will get back to you next Monday.
 *     ```wp-block-code
       Version 7.0Site Language en_USUser Language en_USTimezone +08:00Home URL https://staging.example.comSite URL https://staging.example.comPermalink structure /%postname%/Is this site using HTTPS? YesIs this a multisite? NoCan anyone register on this site? NoIs this site discouraging search engines? NoDefault comment status ClosedEnvironment type productionUser count 5Communication with WordPress.org WordPress.org is reachable
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-warning-undefined-array-key-excerptlength-2%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [SRD75](https://wordpress.org/support/users/srd75/)
 * Last activity: [20 hours, 39 minutes ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-excerptlength-2/#post-18942855)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
