Title: PHP Warning: Undefined array key 0 in wp-persistent-login-user-count.php
Last modified: May 14, 2024

---

# PHP Warning: Undefined array key 0 in wp-persistent-login-user-count.php

 *  [debruning](https://wordpress.org/support/users/debruning/)
 * (@debruning)
 * [2 years ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-0-in-wp-persistent-login-user-count-php/)
 * Hey there,
 * Been using your plugin for some time, love it, but hoping a little something 
   can be removed from my logs:
 * PHP Warning: Undefined array key 0 in wp-persistent-login-user-count.php on line
   566
 * On an average weekend I get thousands of these notices 🙂
 * Plugin Version: 2.1.0
 * PHP Version: 8.0
 * I’ll see if I can find the fix myself, but thought I would throw this out here
   as well, hope you’re having a great week!
 * David

Viewing 1 replies (of 1 total)

 *  Thread Starter [debruning](https://wordpress.org/support/users/debruning/)
 * (@debruning)
 * [2 years ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-0-in-wp-persistent-login-user-count-php/#post-17754713)
 * I’ve initialized it with the following snippet:
 * if (!isset($user_count[$role])) { $user_count[$role] = 0; }
 * Hoping this will address it, will post a follow up if it sorts things out. 🙂

Viewing 1 replies (of 1 total)

The topic ‘PHP Warning: Undefined array key 0 in wp-persistent-login-user-count.
php’ is closed to new replies.

 * ![](https://ps.w.org/wp-persistent-login/assets/icon-256x256.jpg?rev=1847715)
 * [Persistent Login](https://wordpress.org/plugins/wp-persistent-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-persistent-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-persistent-login/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-persistent-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-persistent-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-persistent-login/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [debruning](https://wordpress.org/support/users/debruning/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-0-in-wp-persistent-login-user-count-php/#post-17754713)
 * Status: not resolved