Title: PHP Warning: Undefined array key &#8220;data&#8221;
Last modified: August 5, 2022

---

# PHP Warning: Undefined array key “data”

 *  Resolved [jnz31](https://wordpress.org/support/users/jnz31/)
 * (@jnz31)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-data/)
 * just found this error in my log
    mod_fcgid: stderr: PHP Warning: Undefined array
   key “data” in /…/wp-content/plugins/wp-rest-cache/includes/api/class-endpoint-
   api.php on line 232
 * the line goes
    `if ( ! empty( $result ) && is_array( $result ) && ( ( is_array(
   $result['data'] ) && isset( $result['data']['status'] ) && 200 !== (int) $result['
   data']['status'] ) || 200 !== http_response_code() ) ) {`
 * i guess this one is causing the issue: is_array( $result[‘data’]
    would be better
   to determine data via array_key_exists( ‘data’, $result ), no?
 * i changed it to
    `if ( ! empty( $result ) && is_array( $result ) && ( ( array_key_exists('
   data', $result ) && isset( $result['data']['status'] ) && 200 !== (int) $result['
   data']['status'] ) || 200 !== http_response_code() ) ) {`

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

 *  [ubeo](https://wordpress.org/support/users/ubeo/)
 * (@ubeo)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-data/#post-15905615)
 * Same issue here. The first time the endpoint is loaded, there is a warning, which
   cause and issue when reading the data.
 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-data/#post-15911175)
 * Hi [@jnz31](https://wordpress.org/support/users/jnz31/) and [@ubeo](https://wordpress.org/support/users/ubeo/)
 * Thank you for using our plugin!
 * Did you guys update to the latest version of our plugin? Because in the latest
   version we did fix an issue with this specific line and it looks different now
   than in your example.
 *  Thread Starter [jnz31](https://wordpress.org/support/users/jnz31/)
 * (@jnz31)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-data/#post-15911188)
 * huh?!
    yes, yes, yes, latest of the latest version running.. everything and all
   is latest, just double-checked aka. 2022.1.0..
 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-data/#post-15911215)
 * [@jnz31](https://wordpress.org/support/users/jnz31/)
 * My bad, I see it isn’t released in the latest deployment. I am going to look 
   into it…
 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-data/#post-15911381)
 * Hi [@jnz31](https://wordpress.org/support/users/jnz31/)
 * We forgot to update the stable tag for our plugin. I just fixed it and deployed
   a new version. This version should resolve the warning, please let me know if
   it is solved for you.

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

The topic ‘PHP Warning: Undefined array key “data”’ is closed to new replies.

 * ![](https://ps.w.org/wp-rest-cache/assets/icon-256x256.png?rev=3328849)
 * [WP REST Cache](https://wordpress.org/plugins/wp-rest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-rest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-rest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-rest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-rest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-rest-cache/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-data/#post-15911381)
 * Status: resolved