Plesk WP Toolkit Unable to get site administrator settings Error Fix (stdClass TypeError in WP_User_Query)
Overview
This article explains a critical issue in Plesk WP Toolkit where administrator information cannot be retrieved and the following error appears:
Code:
Unable to get site administrator settings:
PHP Warning: Object of class stdClass could not be converted to int
PHP Fatal error: Cannot access offset of type stdClass on array
The problem may occur even when the WordPress frontend and admin panel work normally. In most cases, the failure only appears inside WP Toolkit.
Symptoms
- WP Toolkit shows “Unable to get site administrator settings”
- WordPress frontend works normally
- WordPress admin panel works normally
- wp-cli commands work manually
- Error appears only inside WP Toolkit
Root Cause
The issue is caused by a mismatch between PHP environments and cached query data.
- WP Toolkit uses a different PHP binary than system CLI
- CloudLinux alt-php behaves differently than Plesk PHP
- Redis object cache may return corrupted data
- WP_User_Query receives stdClass instead of expected array
Example mismatch:
Code:
WP Toolkit PHP:
/opt/alt/php84/usr/bin/php
Manual CLI PHP:
/usr/bin/php
/opt/plesk/php/8.3/bin/php
This difference causes inconsistent behavior and triggers fatal errors.
Technical Explanation
WordPress uses WP_User_Query to retrieve users.
If query filters or cache return incorrect data:
- stdClass is returned instead of array
- PHP 8+ strict typing triggers fatal error
Common problematic hooks:
Code:
users_pre_query
pre_user_query
Step 1 Check PHP CLI MySQL Support
Code:
php -m | grep -E 'mysqli|pdo_mysql|mysqlnd'
If missing:
Code:
dnf install -y php-mysqlnd
Expected:
Code:
mysqli
mysqlnd
pdo_mysql
Step 2 Verify WP CLI Works
Code:
wp --allow-root user list
Also test:
Code:
wp --allow-root --skip-plugins user list
wp --allow-root --skip-themes user list
Step 3 Reproduce WP Toolkit Environment
Code:
plesk ext wp-toolkit --wp-cli -instance-id 2 -- user list --role=administrator --format=json
If this fails but normal wp works, the issue is environment specific.
Step 4 Identify PHP Difference
Check which PHP WP Toolkit uses.
Example:
Code:
/opt/alt/php84/usr/bin/php
Different PHP environments may load different extensions and cache behavior.
Step 5 Verify WP Toolkit Instance
Code:
plesk ext wp-toolkit --list
plesk ext wp-toolkit --info -instance-id 2
If instance is Working but admin data fails, issue is cache or runtime related.
Step 6 Clear WP Toolkit Cache
Code:
plesk ext wp-toolkit --clear-cache -instance-id 2
systemctl restart sw-engine
systemctl restart psa
Step 7 Disable Redis Temporarily
Code:
wp --allow-root plugin deactivate redis-cache
Then test:
Code:
plesk ext wp-toolkit --wp-cli -instance-id 2 -- user list --role=administrator --format=json
Step 8 Flush Redis Cache
Check Redis:
Code:
redis-cli PING
Expected:
Code:
PONG
Flush cache:
Code:
redis-cli FLUSHALL
Expected:
Code:
OK
Step 9 Reactivate Redis Carefully
Code:
wp --allow-root plugin activate redis-cache
Test again:
Code:
plesk ext wp-toolkit --wp-cli -instance-id 2 -- user list --role=administrator --format=json
If it fails again, Redis configuration is incompatible.
Step 10 Review Custom Plugins
Check plugins affecting:
- user queries
- gettext filters
- global query hooks
- object caching
- admin hooks
High risk patterns:
- users_pre_query usage
- pre_user_query usage
- metadata query manipulation
- translation or output interception plugins
Test by disabling plugins one by one.
Step 11 Optional Deep WP Toolkit Reset
Code:
rm -rf /usr/local/psa/var/modules/wp-toolkit/*
systemctl restart sw-engine
Safe Troubleshooting Flow
- Check CLI PHP MySQL extensions
- Verify wp-cli works
- Reproduce WP Toolkit error
- Clear WP Toolkit cache
- Disable Redis
- Flush Redis
- Retest WP Toolkit
- Reactivate Redis carefully
- Check custom plugins
Key Insight
This is not a WordPress core bug.
It is caused by:
- environment mismatch
- cache corruption
- PHP strict typing
Conclusion
This issue follows a clear pattern:
- WordPress works normally
- WP Toolkit fails
- different PHP environments are used
- cached data causes type errors
By aligning PHP environments and resetting cache layers, the issue can be fully resolved.
This approach ensures stable WP Toolkit operation in CloudLinux and Plesk environments.
Last edited: