Fatal error: Uncaught TypeError: get_object_vars(): Argument #1 ($object) must be of type object, null given in /xxxxx/xxxx/wp-includes/class-wp-theme-json-resolver.php:535 Stack trace: #0 /xxxxx/xxxx//wp-includes/class-wp-theme-json-resolver.php(535): get_object_vars() #1 /xxxxx/xxxx//wp-includes/class-wp-theme-json-resolver.php(691): WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles() #2 /xxxxx/xxxx//wp-admin/site-editor.php(174): WP_Theme_JSON_Resolver::get_user_global_styles_post_id() #3 {main} thrown in /wp-includes/class-wp-theme-json-resolver.php on line 535
means that WordPress is trying to call get_object_vars()
on a null
value — likely because it expected a global styles post object, but didn’t get one.
Root Cause
/wp-includes/class-wp-theme-json-resolver.php on line 535
That file is part of the Full Site Editing (FSE) system in WordPress and is trying to load the Global Styles post for the current theme.
The culprit function is likely:
WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles()
It’s expecting to retrieve a post object (of post type wp_global_styles
), but it’s getting null
.
How to Fix It
1. Flush and Recreate Global Styles
If the Global Styles post is corrupted or missing, WordPress can’t read it.
- Go to your database (
phpMyAdmin
) and check if there’s a post with:post_type = 'wp_global_styles'
post_name
matching your current theme slug
If it’s missing, re-saving your theme settings from the Site Editor (if accessible) will regenerate it.
If not, try switching to a default theme first (see next step).
2. Switch to a Default Theme Temporarily
Your current theme may be incompatible or corrupt.
- Rename the current theme’s folder (
/wp-content/themes/your-theme
) to force WordPress to fall back to a default theme (e.g.,twentytwentyfour
) - OR manually set the default theme in the database (
wp_options
>template
andstylesheet
)
3. Update/Reinstall WordPress Core
There could be a mismatch or corruption in core files:
- Download a fresh copy of WordPress from wordpress.org
- Replace
/wp-includes
and/wp-admin
directories (don’t touchwp-content
) - Do not overwrite
wp-config.php
or.htaccess
4. Disable Site Editor (If Not Needed)
If you’re not using Full Site Editing, you can temporarily disable the Site Editor:
Add this filter in your theme’s functions.php
:
phpCopyEditremove_action( 'admin_menu', '_add_site_editor_menu' );
Or simply avoid accessing /wp-admin/site-editor.php
.
Debug Option
You can prevent the error from halting the entire site by editing the relevant file only for debugging:
phpCopyEdit// In class-wp-theme-json-resolver.php, line ~535
if ( is_null( $post ) ) {
return array(); // or return new stdClass();
}
But this is a temporary fix to prevent a crash — not a solution.
Summary of Steps
Step | Action |
---|---|
1 | Check if global styles post exists in DB |
2 | Switch to default theme |
3 | Update WordPress core |
4 | Temporarily disable Site Editor (if not used) |
5 | Re-enable plugins/themes one by one |
“If it still doesn’t work, please check the structure of your
prefix_posts
table. It’s possible that theID
column is missing theAUTO_INCREMENT
attribute or / AND is not set as the primary key.