Title: Notice : Function WP_Object_Cache::get was called incorrectly
Last modified: November 27, 2022

---

# Notice : Function WP_Object_Cache::get was called incorrectly

 *  Resolved [wjh](https://wordpress.org/support/users/wjh/)
 * (@wjh)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/notice-function-wp_object_cacheget-was-called-incorrectly/)
 * Hello!
    - WP 6.1.1 (Multisite)
    - EM 6.1.4
    - PHP 7.4.3x
 * After recently updating WordPress from v6.0 to v6.1.1 (the latest version as 
   of this post), the following error notice displays on all pages showing a list
   of events:
 * `Notice: Function WP_Object_Cache::get was called incorrectly. Cache key must
   be integer or non-empty string, NULL given. Please see Debugging in WordPress
   for more information. (This message was added in version 6.1.0.) in .../wp-includes/
   functions.php on line 5835`
 * A notice shows for each event in the list, so for example 10 events = 10 error
   messages.
 * This is of course **not** a critical error; the events list displays and functions
   correctly. But I’d just thought you might like a heads-up 🙂
 * One can currently see this error displaying on these 2 websites using Events 
   Manager on WP 6.1+ and PHP 7.4+: [Example 1](https://www.therathskeller.co.uk/)
   and [Example 2](https://www.shoasis.co.uk/events/shoasis-do-xmas-canvey-fc/) [
   NOT my sites; found via search engine]
 * Something to fix for a future release perhaps?
 * Cheers 🙂

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

 *  [Thorsten Schraut](https://wordpress.org/support/users/hyperbrand/)
 * (@hyperbrand)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/notice-function-wp_object_cacheget-was-called-incorrectly/#post-16248895)
 * Hi, I have exactly the same problem with the list view. Same set up: WP 6.1.1
   and PHP 7.4. The calendar view works fine.
 * Best,
    Thorsten
 *  Thread Starter [wjh](https://wordpress.org/support/users/wjh/)
 * (@wjh)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/notice-function-wp_object_cacheget-was-called-incorrectly/#post-16253878)
 * Thanks [@hyperbrand](https://wordpress.org/support/users/hyperbrand/).
 * FYI just updated to EM 6.1.5; unfortunately this error notice still shows for
   event lists.
 * Maybe it will be fixed with the next release? One can only hope 🙂
 *  [Thorsten Schraut](https://wordpress.org/support/users/hyperbrand/)
 * (@hyperbrand)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/notice-function-wp_object_cacheget-was-called-incorrectly/#post-16254384)
 *     ```
       [01-Dec-2022 18:34:34 UTC] PHP Notice:  Trying to get property 'post_type' of non-object in /wp-content/plugins/events-manager/classes/em-event-post.php on line 111
       [01-Dec-2022 18:34:36 UTC] PHP Notice:  Die Funktion WP_Object_Cache::get wurde <strong>fehlerhaft</strong> aufgerufen. Der Cache-Schlüssel muss eine Ganzzahl oder eine nicht leere Zeichenfolge sein, NULL ist der vorgegebene Typ. Weitere Informationen: <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress (engl.)</a>. (Diese Meldung wurde in Version 6.1.0 hinzugefügt.) in /wp-includes/functions.php on line 5835
       [01-Dec-2022 18:34:36 UTC] PHP Notice:  Die Funktion WP_Object_Cache::set wurde <strong>fehlerhaft</strong> aufgerufen. Der Cache-Schlüssel muss eine Ganzzahl oder eine nicht leere Zeichenfolge sein, NULL ist der vorgegebene Typ. Weitere Informationen: <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress (engl.)</a>. (Diese Meldung wurde in Version 6.1.0 hinzugefügt.) in /wp-includes/functions.php on line 5835
       ```
   
 *  Thread Starter [wjh](https://wordpress.org/support/users/wjh/)
 * (@wjh)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/notice-function-wp_object_cacheget-was-called-incorrectly/#post-16295804)
 * FYI just updated to EM 6.1.6; unfortunately this error notice still shows for
   event lists.
 * Any plans on fixing this soon?
 * Cheers
 *  [jamuel](https://wordpress.org/support/users/jamuel/)
 * (@jamuel)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/notice-function-wp_object_cacheget-was-called-incorrectly/#post-16528340)
 * For what it’s worth I don’t see this message when logged into my site. Only if
   I’m a public/guest accessing the site.
 *  [jayharland](https://wordpress.org/support/users/jayharland/)
 * (@jayharland)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/notice-function-wp_object_cacheget-was-called-incorrectly/#post-16547349)
 * I was experiencing the same thing and I believe I have found the culprit.
 * The notice is pretty clear whats happening (though it does a poor job saying 
   where it happened) and so I searched the plugin code for instances of `wp_cache_get`
   and `wp_cache_set`. I then looked at what values were being passed as the key.
 * Low and behold, in `em-taxonomy-term.php` on line 118, inside of a function named`
   get_color()`, `wp_cache_get` and `wp_cache_set` are utilized with the `term_id`
   as the key if color is not set. This was the problem for me as some of my events
   had no category and thus no `term_id`!
 * In `em-taxonomy-term.php` I added an additional check for `get_color()`:
 *     ```wp-block-code
       if( empty($this->color) && !empty($this->term_id))
       ```
   
 * This cleared up the notices for me, though I bet that just ensuring all events
   had a category would also do the trick. I hope this helps!
    -  This reply was modified 3 years, 2 months ago by [jayharland](https://wordpress.org/support/users/jayharland/).

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

The topic ‘Notice : Function WP_Object_Cache::get was called incorrectly’ is closed
to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 7 replies
 * 4 participants
 * Last reply from: [jayharland](https://wordpress.org/support/users/jayharland/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/notice-function-wp_object_cacheget-was-called-incorrectly/#post-16547349)
 * Status: resolved