Title: Function WP_User_Query::query was called incorrectly
Last modified: March 3, 2024

---

# Function WP_User_Query::query was called incorrectly

 *  [moji_vb](https://wordpress.org/support/users/moji_vb/)
 * (@moji_vb)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/function-wp_user_queryquery-was-called-incorrectly/)
 * There is also a report of this bug around one year ago(16 feb 2023) by user sgrassl
   which its topic was closed without any debug reports.
 * This is exact php notice appeared in wp logs when I activate this plugin:
 * [03-Mar-2024 03:51:15 UTC] PHP Notice: Function WP_User_Query::query was called**
   incorrectly**. User queries should not be run before the `plugins_loaded` hook.
   Please see [Debugging in WordPress](https://wordpress.org/support/article/debugging-in-wordpress/)
   for more information. (This message was added in version 6.1.1.) in /home/cdks/
   domains/cdkeysell.ir/public_html/wp-includes/functions.php on line 5835.
 * which cause add to cart button (shopping ability for woocommerce) not work (I’m
   a php developer so I could see generated json data file for adding to cart button
   is corrupted by this php notice added to begging of json file which should only
   include data). This happens only when user is logged in to the site and your 
   plugin must be active too (I did checked this in logged out state both with and
   without product cache and its fine even when clearfy is active). If I disable
   your plugin this notice will disappear.
 * Hope this helps development team to debug.

Viewing 1 replies (of 1 total)

 *  Thread Starter [moji_vb](https://wordpress.org/support/users/moji_vb/)
 * (@moji_vb)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/function-wp_user_queryquery-was-called-incorrectly/#post-17469395)
 * Temporary fix suggestion:
 * I temporary skipped user shopping problem by manually adding this code to clearfy.
   php for my site:
 * error_reporting(E_ALL & ~( E_USER_NOTICE ));

Viewing 1 replies (of 1 total)

The topic ‘Function WP_User_Query::query was called incorrectly’ is closed to new
replies.

 * ![](https://ps.w.org/clearfy/assets/icon-256x256.gif?rev=2392119)
 * [Clearfy Cache – WordPress optimization plugin, Minify HTML, CSS & JS, Defer](https://wordpress.org/plugins/clearfy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/clearfy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/clearfy/)
 * [Active Topics](https://wordpress.org/support/plugin/clearfy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/clearfy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/clearfy/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [moji_vb](https://wordpress.org/support/users/moji_vb/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/function-wp_user_queryquery-was-called-incorrectly/#post-17469395)
 * Status: not resolved